Guide to Using TortoiseGIT with GitHub
- Download and install Git from: http://git-scm.com/downloads
- Using the Git Bash from the context menu (i.e., right mouse click on desktop), follow the instructions to set up the Username and Email for Git from: https://help.github.com/articles/set-up-git
Because GitHub uses SSH, here are the steps to set up SSH for TortoiseGIT:
- Set up your private and public SSH identification following these instructions: https://help.github.com/articles/generating-ssh-keys
The next steps are not strictly necessary. You will only need to do these if you want to have persistent SSH connection (so that you don't have to type your password every time you try to Git Push)
- Look inside your TortoiseGit directory, and run the program
puttygen.exe
- Under the menu item
Conversions
, select Import Key
- Find the id_rsa file that you created in step (3), you will be prompted for your passphrase. Enter it.
- Change the field
Key comment
if you want to (I changed mine to Remco Chang
)
- Click on
Save private key
. I saved mine as: id_rsa_putty.ppk (and left it in the same folder as id_rsa)
- IMPORTANT: bring up the TortoiseGit context menu, go to
settings
. Click on Network
, and change the SSH Client to using TortoisePLink.exe. Note that your TortoisePLink.exe should be in the same folder as pagent.exe.
Using Git
- First, find a directory where you would like to keep all of your local Git repositories. Just to be safe, put it in a directory where the path to it does not include empty spaces or weird characters. These can sometimes cause problems when you use a unix-based application. A safe place would be C:\Repos
- Inside this folder, right click in the window to bring up the context menu. Select
Git Clone
- For the URL, you can find the SSH URL in the github website. For example, for the Prospectus repository, go to: https://github.com/TuftsVALT/prospectus. Note that on the right hand side, there’s a SSH clone URL on the web page. Copy that string (which is:
git@github.com:TuftsVALT/prospectus.git
)
- Copy that string to the URL into the TortoiseGit clone menu. Modify the field for directory to fit your preference.
- Assuming that you did the steps for persistent SSH connection, you will now be able to check the checkbox:
Load Putty Key
. Give the path to your id_rsa_putty.ppk file.
- That's it! You might be asked to type in your passphrase once. This, incidentally, will run Pagent.exe – you can see this program running in your system tray. Do not kill this process. Killing it will break your persistent SSH connection. You can verify the SSH key that you are using to connect to GitHub if you right click and select
View Keys
.
Committing, Pushing, and Pulling
- Recall that Git uses a 2-stage process: a local repository and a global repository. Committing is the term for checking in your changes to the local repository (on your computer); whereas Pushing checks your changes to the global repository (at GitHub). Note that you need to commit changes to your local repository before you can push the changes to the global server.
- To check in a change in TortoiseGit, you right click in the window, and select
Git Commit
. Add in some message (to describe the change). Otherwise the system won't let you perform the commit.
- A progress bar will appear. After a successful commit, click on the
Push
button on the lower left hand corner of this dialog box to check the changes into the global server.
- For most cases, you can just click on
OK
to upload the changes.
- Note that if the status says anything about how the process is not successful (or does not exit cleanly), it means that your local copy is not up to date. For such a case, do a
Pull
first to update your local repository. Once the Pull
is completed, you can perform the Push
again.