Tuesday, March 27, 2012

Setting up Git, Git Extensions and GitHub account

This tutorial indeed for people who is not familiar with Git and GitHub and make first steps with this this technology. The tutorial contains following steps:

Installing Git and Git Extensions

Setting up GitHub account ,SSH keys and repository

Working with GitHub repository with Git Extensions

Cloning public repository from GitHub

Installing Git and Git Extensions

Git Extensions is an open-source project provides graphical user interface for Git that allows you control Git without using the command line. It's download includes msysgit - implementation of Git for Windows.

Download and run latest build from download page . I use version 2.29 for this tutorial. Follow installation wizard with taking notes below:

When you run installer you get welcome page:

Go next till you get "Required Software" page:

Since Git Extensions is only graphical tool, it requires Git installed. If you are not sure you have proper git installation, just select option "Install MsysGit". KDiff is a diff/merge tool, not the best one, but free. I recommend you select it as well.

Go next till you get "Select SSH client" page:

Ensure you select "PuTTY". It is an easiest way to work with SSH on Windows.

Go next till you get MsysGit installer running (as part of Git Extensions installation).

Select following settings during installation (it is can be changed after installation).

Finally you get "Complete installation" page with "Finish" button.

Congratulations! You have Git and Git Extensions installed. Run it!

When you run Get Extensions for fist time, it comes with settings page with error:

Don't be scared, it is normal for first time. Just click "Repair" and fill missing details

That's it. Now you are ready to work with Git repository.

Setting up GitHub account ,SSH keys and repository

Go to https://github.com/signup/free to set up you free account. Registration process is very simple. If you already have GitHub account, skip this step.

Once you have an account at GitHub, log in and go to your account SSH keys configuration page https://github.com/settings/ssh. If you first time here, you have an empty list.

Now it is time to create your SSH key. You may follow instructions from GitHub, but I want to show you my way.

When we installed Git Extensions, we selected "PuTTY" as SSH client and it resulted with helpful PuTTY utilities was installed. You may find them in C:\Program Files (x86)\GitExtensions\PuTTY folder (or C:\Program Files\GitExtensions\PuTTY on 32bit Windows)

Run puttygen.exe, click "Generate" button and move mouse over black area while progress is displayed.

This way you generated your SSH key.

Now save private key (you may select passphrase (password) if you want). Note: you have to keep you private key in secret.

Copy text from textbox above - it is your public key. This is what you put into your GitHub account. You can always get this public key by loading your private key in puttygen. (File > Load private key).

Click "Add SSH key", give a name for this key and copy you public key from puttygen. Click "Add key" -
SSH Keys list shows your newly created key:

Creating repository is very simple. From main page (https://github.com/) click "New repository", fill the form and click "Create repository" - you will get instructions how to set up Git. You may follow this instructions, or follow my way I used to go.

Working with GitHub repository with Git Extensions.

First of all you have to know your repository url. Take it from GitHub instruction page:

Open Git Extensions and click "Clone repository"

Fill repository url and destination. Then click "Load SSH key".

Select you previously saved private key and click "Load". It might prompt password, if you set up one when saved the private key.

Since we have created master branch in GitHub repository, it's page doesn't show Git set up instructions, but all repository related information:

All further commit with this repository are similar to first one. You make changes, stage them, commit and push.

Cloning public repository from GitHub

If you want to clone some public repository from GitHub, you have to follow the same steps as you clone your own repository. The difference is in repository url. To obtain repository url go repository page.