Using Git and Github on Windows

Github is all the rage for source control / hosting OpenSource projects right now - which is a great thing, because for end-users who just want to grab a .zip file of the code or report an issue, it's really easy to use. If you want to check your code in to Git though, and you're on Windows, it can be hard to know where to start. I just went through the process of setting it up, so I thought others might find this useful. Here's the steps I took:
  1. Download and install "msysgit" from http://code.google.com/p/msysgit/ (from "featured downloads" on the right of the screen). This provides the core command-line Git functionality.
  2. To make life easier, download and install Tortoise Git from http://code.google.com/p/tortoisegit/ which is just like Tortoise SVN, which I use for SVN, and works great. It's completely visual and feels like native part of Windows.
  3. Download and install Putty and PuttyGen (I selected the installer for the full suite because I'm not sure exactly which things you might need) - you'll need this to generate an SSH key. http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
  4. Create an account on GitHub - https://github.com/
  5. Create a repository on GitHub.
  6. In "Account Settings" on GitHub, click on "SSH Public Keys" and add a new key. The title should be your email address. To generate the key itself, use PuttyGen, which you downloaded earlier, and copy-paste it in.
  7. Right click in the folder which you want to check-in to Git. Select Git Create repository here. Create it.
  8. Right click in the folder again. From the right-click menu, select Tortoise Git - Settings.
  9. Make sure Tortoise Git has found MSysGit.
  10. In Git - Config, add your name and email address - this should match your GitHub settings.
  11. In Git - Remote, select Add New. Add the private key from Putty that you generated earlier. The private key is a file rather than something you copy-paste. Get the URL and name from the "Source" or "Admin" tabs of your repo on the github website.
  12. Select all the files you want to check-in, right-click and select Tortoise Git - Add...
  13. Right click again and select Tortoise Git - Commit -> Master.
  14. Hopefully it should all upload and you're done!
Don't ask me any difficult questions, because I'm surprised I got this working myself, but good luck! I'm liking Git so far.

Comments

Sean Hess said…
I'm pretty sure you can generate an ssh key using msysgit itself. "ssh-keygen -t rsa". You don't need Putty
Iain said…
@Sean - you probably can but I'm allergic to command lines :)
Juan Villegas said…
We are all allergic to cl. Good explanation btw
Anonymous said…
thank you this worked for me