1.下载源码包
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.18.0.tar.xz
2.解压
tar -zxf git-2.18.0.tar.xz
3.安装依赖包
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
4. 进入源码
cd git-2.18.0
5.执行编译
make prefix=/usr/local/git all
6.执行安装
make prefix=/usr/local/git install
7.环境变量配置
打开文件:vim /etc/profile
在最后添加
PATH=$PATH:/usr/local/git/bin
export PATH
保存
重启系统:reboot