centos7.4 升级git至最新版本
阿里云ECS安装的centos7.4系统,默认git版本是1.8,在使用时会因版本过低产生错误,通过升级至最新版本,即可解决。
系统版本:
[root@localhost]# cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core)
删除系统自带的低版本git
[root@localhost]# yum remove git
下载安装git新版本yum源
[root@localhost]#wget [root@localhost]# rpm -Uvh ius-release*rpm
安装时如果出现以下错误,可通过yum安装epel-release解决。
warning: ius-release.rpm: Header V4 DSA/SHA1 Signature, key ID 9cd4953f: NOKEY error: Failed dependencies: epel-release = 7 is needed by ius-release-1.0-15.ius.centos7.noarch
[root@localhost]#wget [root@localhost]#yum install epel-release
再次执行,安装成功
[root@localhost]# rpm -Uvh ius-release*rpm warning: ius-release.rpm: Header V4 DSA/SHA1 Signature, key ID 9cd4953f: NOKEY Preparing... ################################# [100%] Updating / installing... 1:ius-release-1.0-15.ius.centos7 ################################# [100%]
yum安装最新版本git
[root@localhost]#yum install git2u
安装完毕,查看版本
[root@localhost]# git --version git version 2.16.4
(完)