Difference between revisions of "Github Setup"

From The Powder Toy
Jump to: navigation, search
(Github setup tutorial)
 
(More references to scons to remove)
 
(7 intermediate revisions by one other user not shown)
Line 1: Line 1:
===  GitHub Set-up ===
+
If you need any extra help setting up git, or just need help fixing a problem with git, ask on development assistance section of the [https://powdertoy.co.uk/Discussions/Categories/Topics.html?Category=5 forums].
 +
 
 
Doing these steps in order is highly recommended.
 
Doing these steps in order is highly recommended.
 
 
 
==== Download and Set Up the Programs ====
 
==== Download and Set Up the Programs ====
 
* Create an account at this site: [[https://github.com/]].
 
* Create an account at this site: [[https://github.com/]].
* Download and install [http://code.google.com/p/msysgit/downloads/list MySysGit]. Get the full installer one. This will install Git, and also Git Bash and Git GUI
+
* Download and install [http://msysgit.github.io/ MSysGit]. Get the full installer one. This will install Git, and also Git Bash and Git GUI.
 
* Download and install [http://www.syntevo.com/smartgit/index.html SmartGit]. This won't be used until later, so you can skip this until needed if you want.
 
* Download and install [http://www.syntevo.com/smartgit/index.html SmartGit]. This won't be used until later, so you can skip this until needed if you want.
 
* Set up SmartGit:
 
* Set up SmartGit:
 
* Choose Non Commercial so you can get unlimited use.
 
* Choose Non Commercial so you can get unlimited use.
* Your API token is at GitHub.com > Account Settings > Account Admin.
+
* Enter your github account information, it will generate an OAuth token.
* Give your email to GitHub (necessary [[https://github.com/account]] 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 [[https://github.com/account]] > 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 ====
 
==== Forking tpt ====
* Go to [[https://github.com/FacialTurd/PowderToypp]] and click the "Fork" button. This will create a copy of The Powder Toy in your account.
+
* Go to [[https://github.com/The-Powder-Toy/The-Powder-Toy]] 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 Repository > Clone.
* Open SmartGit, and go to File > Clone.
+
* Enter the repository URL (https://github.com/name/The-Powder-Toy) and click next
* 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.
 
* 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.
 
* Congratulations! You now have an easy way to make changes to the code and upload it to GitHub.
 +
* To set the username and email inserted into each commit, you can go to Repository -> Settings -> Commit. You should probably set this just in case it decides to put the wrong information instead.
  
 
+
==== Pushing to Github ====
 +
*  Pushing to Github makes it easy for people to read the source and find out what you have changed. You can also just give a link to the github instead of uploading the entire source yourself this way.
 +
* Make sure you have saved all your changes, then open SmartGit
 +
* Any files you may have changed should be listed as "Modified". Clicking a file will show you exactly what has changed.
 +
* Deselect any files by clicking the repository name on the left, then 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.
 +
* It will ask for your github username and password, put these in here
 +
* If you don't want to type this in every time you can use an ssh key, but since that is harder to set up it's not described here (ask on IRC?)
  
 
==== Keeping up to Date ====
 
==== Keeping up to Date ====
* In Smart Git, go to Remote > Manage Remotes
+
* In Smart Git, go to Remote > Add
* 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/The-Powder-Toy/The-Powder-Toy, and name it whatever you want (like "origin")
* 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
* 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
 
* 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.
+
* Under "Fetch From", change it to origin (or whatever you called it). A warning message will appear saying you can only fetch changes, ignore this.
* 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.
+
* There is also an option to either merge or to rebase. It is suggested to use "Merge" but both will have the same effect, just rebase is a little cleaner.
* Click the Merge button
+
* After that, click Pull.
 
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.
 
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.
 
* If the merge went well, you can commit and push the changes.
  
 
+
==== Sending a Pull Request ====
 
+
* It is recommended to ask on IRC before sending a pull request, because things like new elements will probably just be rejected. If you still want to send one, follow these steps.
==== 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.
 
* 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.
+
* Send the request to The-Powder-Toy 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!
 
* If Simon decides to accept your request, your code will be in the official Powder Toy source code. Congratulations!

Latest revision as of 05:47, 25 June 2021

If you need any extra help setting up git, or just need help fixing a problem with git, ask on development assistance section of the forums.

Doing these steps in order is highly recommended.

Download and Set Up the Programs

  • Create an account at this site: [[1]].
  • Download and install MSysGit. 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.
  • Enter your github account information, it will generate an OAuth token.

Forking tpt

  • Go to [[2]] and click the "Fork" button. This will create a copy of The Powder Toy in your account.
  • Open SmartGit, and go to Repository > Clone.
  • Enter the repository URL (https://github.com/name/The-Powder-Toy) and click next
  • 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.
  • To set the username and email inserted into each commit, you can go to Repository -> Settings -> Commit. You should probably set this just in case it decides to put the wrong information instead.

Pushing to Github

  • Pushing to Github makes it easy for people to read the source and find out what you have changed. You can also just give a link to the github instead of uploading the entire source yourself this way.
  • Make sure you have saved all your changes, then open SmartGit
  • Any files you may have changed should be listed as "Modified". Clicking a file will show you exactly what has changed.
  • Deselect any files by clicking the repository name on the left, then 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.
  • It will ask for your github username and password, put these in here
  • If you don't want to type this in every time you can use an ssh key, but since that is harder to set up it's not described here (ask on IRC?)

Keeping up to Date

  • In Smart Git, go to Remote > Add
  • Under URL or Path, type https://github.com/The-Powder-Toy/The-Powder-Toy, and name it whatever you want (like "origin")
  • 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
  • Click Pull, it's the one on the very left
  • Under "Fetch From", change it to origin (or whatever you called it). A warning message will appear saying you can only fetch changes, ignore this.
  • There is also an option to either merge or to rebase. It is suggested to use "Merge" but both will have the same effect, just rebase is a little cleaner.
  • After that, click Pull.

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.

Sending a Pull Request

  • It is recommended to ask on IRC before sending a pull request, because things like new elements will probably just be rejected. If you still want to send one, follow these steps.
  • Go to your Powder Toy repository page on GitHub and press "Pull Request" at the top.
  • Send the request to The-Powder-Toy 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!