下载Git依赖的安装包: sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
下载Git:wget https://github.com/git/git/archive/v2.3.0.zip
解压:unzip v2.3.0
进入git目录:cd git-2.3.0/
安装git:
make prefix=/usr/local/git all
sudo make prefix=/usr/local/git install
把此git目录配置到环境变量中:
sudo vim /etc/profile
把export PATH=/usr/local/git/bin:$PATH添加到最末尾
设置当前环境变量:source /etc/profile
执行git --version显示出版本号即安装成功
参考博客:https://www.cnblogs.com/fanjingfeng/p/6663790.html