一、下载git最新源码
- 进入https://github.com/git/git/tags 页面,下载最新源码,七镜选择的2.42.2版本
- 执行下载命令
wget https://github.com/git/git/archive/refs/tags/v2.42.0.tar.gz
二、开始安装
- 解压
tar -zxvf v2.42.0.tar.gz
- 编译安装
cd git-2.42.0/ yum install curl-devel expat-devel -y make prefix=/usr/local/git all make prefix=/usr/local/git install
3.配置环境变量
cat >> /etc/profile <<EOF > export PATH=\${PATH}:/usr/local/git/bin > EOF source /etc/profile
可以看到已经安装完毕.