Setting up Git and
GitHub on windows xp

Git is a local version control system allowing you to keep a full record of all changes to a project. It uses a local repository which you can use to revert your project to any previous state with some simple commands.

GitHub is a remote repository hosting provider with which you can share your projects. You can check out projects from your GitHub repositories to work on locally using your Git version control, you can then push your project back to GitHub with all of the versioning information so others working on the project can identify your work and read your comments relating to it.

To use Git and connect your windows XP machine to GitHub follow these instructions.

References:
http://github.com/guides/using-git-and-github-for-the-windows-for-newbies
http://kylecordes.com/2008/04/30/git-windows-go/
http://beans.seartipy.com/2008/12/09/setting-up-ruby-on-rails-projects-w...

Download the PuTTY installer

PuTTY is a free and open source terminal emulator application which can act as a client for the SSH, Telnet, rlogin, and raw TCP computing protocols. You need this for Git to communicate securely with your remote repository at GitHub.com.

If you don't already have PuTTY installed you need it.
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Choose "A Windows installer for everything except PuTTYtel"
Once downloaded run the .exe file.

You can just leave the defaults settings

Download and install msysgit

To get Git to run on windows we need a special version, msysgit. Git can also be run on top of Cygwin (a POSIX emulation layer), although it is noticeably slower, especially for commands written as shell scripts.

Get mysysgit from http://code.google.com/p/msysgit/downloads/list
Choose the 'Full installer for official Git'
Once downloaded run the .exe file.

Installing Git
Installing GitInstalling GitInstalling Git

Once we have msysgit (Git) installed we need to open the Git command line 'Git bash' from your 'all programs/git' menu.

Generating keys

First job here is to generate 'keys' to authenticate your computer with GitHub. We are going to do this using the Git Bash command line.

But just before that we should check if you have any existing msys keys on your computer. These are called id_rsa and id_rsa.pub

  1. $ cd ~/.ssh // move to dir where keys are normally stored
  2. $ ls // list contents of .ssh directory
  3. id_rsa id_rsa.pub known_hosts public.ppk
  4. // here you can see I have an existing pair of msys keys
  5. $ mkdir key_backup // make a directory to move old keys
  6. $ cp id_rsa* key_backup // copy keys to key_backup dir
  7. $ rm id_rsa* // remove original keys

Now to generate a new key pair.

  1. $ ssh-keygen -t rsa -C "youremail@address.com"
  2. Generating public/private rsa key pair.
  3. Enter file in which to save the key (/c/Documents and Settings/Elliott/ssh/id_rsa):
  4. Enter passphrase (empty for no passphrase):
  5. Enter same passphrase again:
  6. Your identification has been saved in /c/Documents and Settings/Elliott/ssh/id_rsa.
  7. Your public key has been saved in /c/Documents and Settings/Elliott/ssh/id_rsa.pub.
  8. The key fingerprint is:
  9. e8:ae:60:8f:38:c2:98:1d:6d:84:60:8c:9e:dd:47:81 youremail@address.com

Now using explorer browse to the location of your keys, for me it's C:\Documents and Settings\Elliott.ssh and use a text editor to open id_rsa.pub

We are going to use this key when we create our github account

Creating your GitHub account

Go to www.github.com

Creating GitHub accountSelect 'pricing and signup'

Creating GitHub accountChoose the 'open source' plan

Creating GitHub accountFill out your personal details and copy the contents of id_rsa.pub into the box labelled shh public key and hit accept.

Note: if you open id_rsa.pub in windows notepad it adds an extra character at the end of the key after your email address, a little square. You shouldn't paste this when you copy your key to github.

Testing

If you closed your Git Bash command line open it again.

  1. // you should get the following message if you have successfully authenticated.
  2. ERROR: Hi simonbanta! You've successfully authenticated, but GitHub does not provide shell access.
  3. Connection to github.com closed.

If this is absolutely the first time you have connected to github.com using ssh then it may fail as you don't have the Github server’s host key in your cache.

To add the Github server key to your cache use PuTTY.
Open PuTTY from 'all programs/putty/putty' and type Github.com as the Host Name.

Caching remote server keys with PuTTYClick 'open', your system will then give a security alert.

Caching remote server keys with PuTTYPress 'ok/yes/oui' and then your Putty terminal window will open, which you can immediately close as putty has done it's job and stored Githubs host key.

The next stage

With any luck you all now have Git and GitHub set up on your windows machine. Next blog post will be looking at how to use it.

Have fun ;-)