centos7 的默认源里面的git版本是1.8.3, 比较老了, 对于有些操作会提示git版本太低, 可以使用第三方源的方式来安装新版本的git

使用Wandisco源

创建仓库文件

1
2
3
4
5
6
7
8
cat > /etc/yum.repos.d/wandisco-git.repo <<-'EOF'
[wandisco-git]
name=Wandisco GIT Repository
baseurl=http://opensource.wandisco.com/centos/7/git/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco
EOF

安装git

1
sudo yum install git

查看版本

1
git version

离线安装(手动安装rpm)

下载两个文件到本地

1
2
wget https://file.babudiu.com/f/yXCL/perl-Git-2.31.1-1.WANdisco.1657096008.noarch.rpm
wget https://file.babudiu.com/f/znF4/git-2.31.1-1.WANdisco.1657096008.x86_64.rpm

安装

1
yum install ./*.rpm