Install Git 2.9.5 on CentOS/RHEL 7/6
Step 1 — Install Required Packages
Before installing Git from source code, make sure you have already installed required packages on your system. If not use following command to install required packages.
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
yum install gcc perl-ExtUtils-MakeMaker
Step 2 — Download and Install Git
Download latest Git source code from kernel git or simply use following command to download Git 2.9.5.
cd /usr/src
wget https://www.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz
tar xzf git-2.9.5.tar.gz
After downloading and extracting Git source code, Use following command to compile source code.
cd git-2.9.5
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
Step 3 — Check Git Version
After completing above installation steps. you have successfully install Git on your system. Let’s use following command to check git version.
git --version
git version 2.9.5