Posted by: stephenmit | 30 May 2009

Setting up a local installation of Git

With every new machine comes the need to re-install the bear essentials. This post will briefly outline what is required to get Git setup on a local machine and how to communicate with GitHub. It is assumed that an account is already created on GitHub and that there is an existing repository that you wish to use.

Getting the installation

Git is available for windows users from Google Code, the file directory is located here. On this page there are a variety of versions available, I just went for the most straight forward option, which is the first. This installs the full version of Git required for day to day use.

Once the file has been downloaded, a few steps have to be taken to get through the installer. Clicking through is essentially alright and most of the options are acceptable.

Once Git is installed, it is best to open it up and generate an SSH key to give to GitHub.  Open Git and generate the SSH key by typing the following:

ssh-keygen -C “your@email.address” -t rsa

It will give you an install directory option, and pressing enter will accept the default one. A password is then required, and this will be used every time Git communicates with GitHub. Having the key generated, just navigate to the file and open it. Copy the entire contents and head to GitHub. 

Cloning the first repository

If you are not logged in already, do so and go to the account page. Half way down on the left you can add a new SSH key, just paste what you have already copied in here.

Once the key is generated and given to GitHub,  go back into Git and navigate to where you would like your GitHub repositories to be stored. Clone your existing repository if you have one, by typing

git clone git@github.com:YourUsername/yourrepository.git

This will first ask you if you wish to continue, as it will not recognise the “new” local machine. Typing yes is required to continue. Once this is done, the password given during the generation of the SSH key is required, and Git should then get to work cloning the repository.

That should be it!

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Categories

Follow

Get every new post delivered to your Inbox.