Centos 7 comes with a really old version of Git that is missing handy features like hooks.

Here is how to compile the latest version of Git on CentOS 7 yourself.

Start with updating the system.

sudo yum -y update

Install dnf package manager to get all the improvements over yum.

sudo yum -y install dnf

Add EPEL repository to access packages that are not in the standard repositories.

sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Install build dependencies.

sudo dnf -y install asciidoc curl-devel dh-autoreconf docbook2X expat-devel gettext-devel openssl-devel perl-devel xmlto zlib-devel
sudo dnf -y install wget

Dowload source, verify and extract.

As of writing the latest version of git is 2.38.1 however there may have been a newer version released by the time you are reading this. You can go to this webpage to check if there is a newer version.

export VERSION=2.38.1
wget -L https://mirrors.edge.kernel.org/pub/software/scm/git/git-$VERSION.tar.xz
wget -L https://mirrors.edge.kernel.org/pub/software/scm/git/git-$VERSION.tar.sign
unxz git-$VERSION.tar.xz
gpg --keyserver-options auto-key-retrieve $("git-$VERSION.tar.sign")
tar -xf git-$VERSION.tar
cd git-$VERSION

Build

make configure

Set output to home drive

./configure --prefix=$HOME/.local/$(gcc -dumpmachine)

Run make

make all -j$(nproc)
make install