How to Install Git on Ubuntu 12.04



Git is a distributed revision control and source code management system released in 2005 and distributed under GNU General Public License v.2. Git handles large amounts of data and possesses tracking capabilities which are non-dependent on network access or central server.

This tutorial will cover the installation of Git on Ubuntu 12.04.


Installation of Git Using Apt-Get


You can install Git using the apt-get command:

sudo apt-get install git-core

Once the installation is done, you can proceed to configure it.


Installation of Git from Source


In case if you want the latest version of Git to be installed from source, here is how:

Before starting the installation, update the system packages using apt-get update.

sudo apt-get update

Now, you need to download the required dependencies using the command:

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

Now, install the latest version of Git from google code page:


Untar the file and switch into that directory:

tar -zxf git-
cd git-

Global installation would require two steps – installing as yourself and as root user.

make prefix=/usr/local all
sudo make prefix=/usr/local install

You can update the Git in future using:

git clone git://


Git Set Up


Once Git is installed, you need to copy your username and email in the git config file.

Open the config file and add the following lines of code to it:

sudo nano ~/.gitconfig
git config --global"NewUser"
git config --global [email protected]

Save the file.

If you want to verify the settings, you can use the command:

git config --list

In case if you omit the step of updating your username and email, Git may throw a message similar to this:

[master 0d9d21d] initial project version 
Committer: root <[email protected](none)>
Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate.You can suppress this message by setting them explicitly:
     git config --global "Your Name"
    git config --global [email protected]

 After doing this, you may fix the identity used for this commit with:
     git commit --amend --reset-author


Git is installed on your system.

support2 has written 111 articles

Leave a Reply