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.
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.
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.
Once we have msysgit (Git) installed we need to open the Git command line 'Git bash' from your 'all programs/git' menu.
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
$ cd ~/.ssh // move to dir where keys are normally stored
$ ls // list contents of .ssh directory
id_rsa id_rsa.pub known_hosts public.ppk
// here you can see I have an existing pair of msys keys
$ mkdir key_backup // make a directory to move old keys
$ cp id_rsa* key_backup // copy keys to key_backup dir
$ rm id_rsa* // remove original keys
Now to generate a new key pair.
$ ssh-keygen -t rsa -C "email@example.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Documents and Settings/Elliott/ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Documents and Settings/Elliott/ssh/id_rsa.
Your public key has been saved in /c/Documents and Settings/Elliott/ssh/id_rsa.pub.
The key fingerprint is:
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
Select 'pricing and signup'
Choose the 'open source' plan
Fill 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.
If you closed your Git Bash command line open it again.
$ ssh firstname.lastname@example.org
// you should get the following message if you have successfully authenticated.
ERROR: Hi simonbanta! You've successfully authenticated, but GitHub does not provide shell access.
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.
Click 'open', your system will then give a security alert.
Press '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 ;-)