Default repository often install old version of software. To get the latest version, best way is, install it from the source.

Here I am going to present how to install Git core with command line. I am going to use Ubuntu 12.04 LTS, as the environment.


1. First, update the repository:
sudo apt-get update

2. Install some required dependencies:

sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev build-essential

3. Get the source file:


4. Extract it
tar -zxf git-
cd git-

5. Install it for all users:
make prefix=/usr/local all
sudo make prefix=/usr/local install

6. If you need to update Git in the future, you can use Git itself to do it.

git clone git://

7. Configure Git:

sudo nano ~/.gitconfig

git config --global "NewUser"
git config --global

8. You can see all of your settings with this command:
git config --list

You can change the command syntax for installing Git to other Linux distro such as CentOS or Fedora.
Hope this will help you to start the Git journey.