查看Git相关版本 源码 Release 版本清单.(不要下载带有-rc的,因为它代表了一个候选发布版本)
下载 Git 对应版本的源代码 在CentOS系统中的相关目录执行以下 wget 命令 cmd指令:wget https://www.kernel.org/pub/software/scm/git/git-2.29.0.tar.gz
[root@localhost ~]# pwd /root [root@localhost ~]# wget https://www.kernel.org/pub/software/scm/git/git-2.29.0.tar.gz --2020-10-22 09:08:31-- https://www.kernel.org/pub/software/scm/git/git-2.29.0.tar.gz 正在解析主机 www.kernel.org (www.kernel.org)... 147.75.46.191, 2604:1380:4080:c00::1 正在连接 www.kernel.org (www.kernel.org)|147.75.46.191|:443... 已连接。 已发出 HTTP 请求,正在等待回应... 301 Moved Permanently 位置:https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.29.0.tar.gz [跟随至新的 URL] --2020-10-22 09:08:33-- https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.29.0.tar.gz 正在解析主机 mirrors.edge.kernel.org (mirrors.edge.kernel.org)... 147.75.95.133, 2604:1380:3000:1500::1 正在连接 mirrors.edge.kernel.org (mirrors.edge.kernel.org)|147.75.95.133|:443... 已连接。 已发出 HTTP 请求,正在等待回应... 200 OK 长度:9597273 (9.2M) [application/x-gzip] 正在保存至: “git-2.29.0.tar.gz” 100%[======================================================================================================================================================================================>] 9,597,273 99.8KB/s 用时 66s 2020-10-22 09:09:39 (142 KB/s) - 已保存 “git-2.29.0.tar.gz” [9597273/9597273]) [root@localhost ~]# ls anaconda-ks.cfg git-2.29.0.tar.gz [root@localhost ~]# 解压 gz 包 tar -zxvf git-2.29.0.tar.gz 执行上述解压之后,在当前目录(也可以指定解压目录)出现如下图文件夹 进入解压的 git 目录进行配置 [root@localhost ~]# cd git-2.29.0 [root@localhost git-2.29.0]# pwd /root/git-2.29.0 [root@localhost git-2.29.0]#./configure --prefix=/usr/local/git 其中 --prefix 为指定安装路径
编译与安装 make && make install配置全局路径 # 对个人安装的软件进行配置全局路径>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> export GIT_HOME=/usr/local/git # Git 软件 export PATH=.:${GIT_HOME}/bin:$PATH刷新配置文件(即立即生效)source /etc/profile
查看已安装好的 git 版本 [root@localhost git-2.29.0]# git --version git version 2.29.0 [root@localhost git-2.29.0]#