1、安装编译工具 yum -y groupinstall "Development Tools"

2、安装依赖包 yum -y install zlib-devel perl-ExtUtils-MakeMaker asciidoc xmlto openssl-devel curl-devel expat-devel gettext-devel

3、下载 Git 最新版本的源代码 wget https://www.kernel.org/pub/software/scm/git/git-2.19.0.tar.gz 登录https:///git/git/releases查看git的最新版。不要下载带有-rc的,因为它代表了一个候选发布版本。

4、解压 tar -zxvf git-2.19.0.tar.gz

5、进入目录配置 cd git-2.19.0 ./configure --prefix=/usr/local/git 出现错误 -bash: ./configure: No such file or directory 查看官方文档https://git-scm.com/book/en/v2/Getting-Started-Installing-Git git-2.19.0需要使用make configure命令

#make configure GIT_VERSION = 2.19.0 GEN configure 如果出现 /bin/sh: autoconf: command not found 安装一个autoconf

#yum install autoconf 再次运行make configure可以了。 再执行 ./configure --prefix=/usr/local/git

6、安装 make && make install

7、配置全局路径 export PATH="/usr/local/git/bin:$PATH" source /etc/profile

8、查看git版本 git --version


参考: https://blog.csdn.net/Juladoe/article/details/76170193 https://blog.csdn.net/zffeng123/article/details/82251668