CentOS 7 - Install current (v2.x) Git

Simply installing git via yum install git deploys an old version of git (v1.8) on your machine. This is clearly not very useful. For most git-based applications, like Bitbucket, we need a recent version of git.

There exist two ways of doing this: Add a new rpm repository to the system which provides a recent git version or build git from the source. Because I am not a friend of adding repositories to a system, just to simply install one package, we are going to built git from the source.

You can find the current releases on GitHub

We need to first install all dependencies for the build:
sudo yum groupinstall "Development Tools" -y
sudo yum install wget perl-CPAN gettext-devel perl-devel openssl-devel zlib zlib-devel curl-devel expat-devel -y

The group “Development Tools” sadly contains the above mentioned old git. We need to remove it beforehand:
sudo yum remove git -y