1.卸载git旧版本

yum remove git

2.安装依赖包

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc
yum install  gcc perl-ExtUtils-MakeMaker

3.编译安装最新的git版本

cd /usr/local/src/wget -O git.zip https://github.com/git/git/archive/master.zipunzip git.zipcd git-mastermake prefix=/usr/local/git allmake prefix=/usr/local/git install

4.添加到环境变量

echo "export PATH=$PATH:/usr/local/git/bin" >> ~/.bashrcsource ~/.bashrc

5.git最新版本更新完成

git --version