第一步、下载源代码文件
wget https://github.com/git/git/archive/v2.21.0.tar.gz
第二步、安装相关依赖
sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
sudo yum install openssl-devel gettext asciidoc xmlto docbook2x
第三步、编译安装
tar -zxvf git-2.21.0.tar.gz
cd git-2.21.0
make configure
./configure --prefix=/usr
make all doc
make install install-doc install-html
原文:https://www.cnblogs.com/fancyop/p/SourceCodeInstall.html