卸载低版本的Git:
yum remove git
下载最新版本的Git:
wget https://www.kernel.org/pub/software/scm/git/git-2.18.0.tar.gz
解压
进入目录git-2.18.0:
参考:https://blog.youkuaiyun.com/zgrbsbf/article/details/68927372
安装依赖的库
make configure
./configure --prefix=/usr/local/git
make profix=/usr/local/git
make install
参考:https://blog.youkuaiyun.com/zzpzheng/article/details/52132385
(直接执行下面的代码的话会出现上面表格中的错误,所以需要先执行上面的代码)
# make prefix=/usr/local/git all
# make prefix=/usr/local/git install
# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
# source /etc/bashrc
git --version