Difference between revisions of "Github Setup"

From The Powder Toy
Jump to: navigation, search
(Github setup tutorial)
(No difference)

Revision as of 22:27, 21 October 2012

GitHub Set-up

Doing these steps in order is highly recommended.


Download and Set Up the Programs

  • Create an account at this site: [[1]].
  • Download and install MySysGit. Get the full installer one. This will install Git, and also Git Bash and Git GUI
  • Download and install SmartGit. This won't be used until later, so you can skip this until needed if you want.
  • Set up SmartGit:
  • Choose Non Commercial so you can get unlimited use.
  • Your API token is at GitHub.com > Account Settings > Account Admin.
  • Give your email to GitHub (necessary [[2]] under email addresses).


Generating a ssh key

  • Open GitBash (from the first program you installed) and type this then hit enter:
  • ssh-keygen -t rsa -C "<yourgithubusernamewithout<>signs>@github.com"
  • Leave the file location blank when it prompts you.
  • Type a strong passphrase and confirm the passphrase (they will not show up, so don't be surprised it looks blank).
  • Open this with notepad: C:\WINDOWS\Users\<username>\.ssh\id_rsa.pub. Make sure to have the File Type setting on All Files, instead of Text Documents.
  • Go to [[3]] > SSH Public Keys. Copy the entire file contents into the the "Key" box. Make sure you don't add any extra spaces or lines (there IS an extra line at the end, though). Leave the Title text box blank and hit "Add key".

To verify That you correctly set up your ssh key:

  • Open GitBash and type: $ ssh git@gitbash.com
  • Type your passphrase you made earlier and click Yes. If it doesn't work, try
  • $ ssh git@github.com
  • If it still doesn't work, verify you did step 6 right (set another file location or overwrite).


Forking tpt

  • Go to [[4]] and click the "Fork" button. This will create a copy of The Powder Toy in your account.
  • Download the source code.
  • Open SmartGit, and go to File > Clone.
  • Press "Select from GitHub" and choose your repository.
  • If your rsa_pub file (the one you made in step # isn't highlighted and the program asks, choose it.
  • Type in your passphrase if the program prompts you.
  • Choose the directory where you want to store the source files.
  • Congratulations! You now have an easy way to make changes to the code and upload it to GitHub.


Keeping up to Date

  • In Smart Git, go to Remote > Manage Remotes
  • Click Add. Under name, type The-Powder-Toy (or whatever you want it to be known as)
  • Under URL or Path, type https://github.com/FacialTurd/PowderToypp
  • After it's verified, you then have to wait for commits you want to be made to the official repo. Once this happens, you can continue with these steps. (Or, just go to Making a Pull Request)
  • Click Pull, it's the one on the very left
  • Under "Remote Repository", change it to The-Powder-Toy (or whatever you called it). A warning message will appear saying you can only fetch changes, ignore this. Click Pull.
  • After that, click Merge. Select the latest commit from the official branch that you want merged in. Also, make sure you don't have the cherry-picked option on instead of the merge one.
  • Click the Merge button

There may be merge conflicts. This will happen if you modified something (ex. added a new element), and then Simon modified the same thing (ex. added a different element), and it can't figure out what to use. You will have to solve these yourself. Around every conflict, there will be a "<<<<<<" your code "======" Simon's code ">>>>>>". You have to decide which one to use. Sometimes, you want both, you have to decide what to do to merge them best. Once you have solved every conflict in a file, right click it in smart git and click "Resolve". Then, "leave as is". Once you have resolved all the errors, you can push the merge commit, and your code and Simon's will be merged together.

  • If the merge went well, you can commit and push the changes.


Making a Pull Request

  • To make changes and send a request to Simon to have it implemented in the official code, open SmartGit (make sure you've saved your changes in Visual Studio).
  • Any files you may have changed should be listed as "Modified".
  • Press "Commit" at the top, list the things you have changed in the text box, and press "Commit".
  • Press "Push" at the top, and press "Push" again.
  • Go to your Powder Toy repository page on GitHub and press "Pull Request" at the top.
  • Send the request to facialturd (Simon's username) and you should be done. Verify that the code has been changed if you like.
  • If Simon decides to accept your request, your code will be in the official Powder Toy source code. Congratulations!