How to Install Git on Debian 7


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


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.

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


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

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


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 vi ~/.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


Git is installed on your system.


KB Admin has written 46 articles