If you happen to download the minimal iso of centos on from it’s website. You can get Git thru Centos’ default repository but you’re going to have an older version of Git. (At the time of writing the default repo has Git version 1.8)
Getting Git thru Default Repo
yum install git
Getting New Version of Git
Install all required dependency to compile from source
yum groupinstall 'Development Tools' yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-ExtUtils-MakeMaker yum install wget
Download the tarbal from Git’s Github repository. Git Releases At the time of writing the latest stable version is 2.9.3.
Extract the tarbal
tar -zxf v2.9.3.tar.gz
Go to the extracted directory and compile the source.
cd git-2.9.3 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
To verify the installation check the Git version