Out of the box, Red Hat Enterprise Linux 7 (RHEL) comes with git version 126.96.36.199, which is quite old. In fact its so old that some apps complain about it, the gitlens plugin for VSCode for example. Unlike other Linux distributions you need to download the git source and compile it for RHEL - which is a bit daunting. I found some decent instructions on github (here), but it pulled up a few errors. So i decided to create a shell script to both remove the existing git install and install git 2.9.0. (The script is basically the github example with a few tweaks).
#!/bin/bash #Based on https://gist.github.com/matthewriley/b74fa53594db1354e5593994c5d5b5a4 yum -y remove git yum -y clean packages mkdir tempgit cd tempgit yum install -y autoconf cpio curl-devel expat-devel gcc gettext-devel make openssl-devel perl-ExtUtils-MakeMaker zlib-devel wget -O v2.9.0.tar.gz https://github.com/git/git/archive/v2.9.0.tar.gz tar -xzvf ./v2.9.0.tar.gz cd git-2.9.0/ make configure ./configure --prefix=/usr/local/git make && make install ln -sf /usr/local/git/bin/* /usr/bin/ cd .. rm -fr git-2.9.0 cd .. rm -fr tempgit echo "results" which git git --version
The script is also available here