At the time of writing Git version 2.6.4 is the latest stable version available. This tutorial will help you to install Git client on your Linux systems.

Install on Ubuntu & LinuxMint:

Use the following set of commands to install Git client on Ubuntu, Debian and LinuxMint systems.

$ sudo add-apt-repository ppa:git-core/ppa
$ sudo apt-get update
$ sudo apt-get install git

Now verify the installed version of Git client.

$ git --version

git version 2.6.4

Install on CentOS/RHEL

Use the following set of commands to install Git client on CentOS, Red Hat and Fedora systems.

First install some required packages.

# yum install curl-devel expat-devel gettext-devel
# yum install gcc openssl-devel zlib-devel perl-ExtUtils-MakeMaker

Now download latest git source code and extract it.

# cd /usr/src
# wget https://www.kernel.org/pub/software/scm/git/git-2.6.4.tar.gz
# tar xzf git-2.6.4.tar.gz

Let’s compile source code using following commands.

# cd git-2.6.4
# make prefix=/usr/local/git all
# make prefix=/usr/local/git install
# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
# source /etc/bashrc

Now verify the installed version of Git client.

# git --version

git version 2.6.4