CentOS 7的 Git 默认是1.8版本,升级到2.41,过程如下:
编辑源
vim /etc/yum.repos.d/wandisco-git.repo
内容如下:
[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
导入key文件
rpm --import http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco
更新Git
yum -y update git
如要升级到指定的版本,例如 2.41.0,使用如下命令
yum install git-2.41.0
如果更新过程出错,则删除后重新安装,命令如下:
yum remove git
yum install git
检查升级结果
git --version