Centos7升级git

centos7使用yum安装的git版本是1.8.x,有些情况下使用会出现状况。这里记录一下升级git

查看git版本

1
2
[root@k8s-77-166 ~]# git version
git version 1.8.3.1

删除旧版本git

1
2
3
4
5
6
[root@k8s-77-166 ~]# yum list installed |grep git
crontabs.noarch                      1.11-6.20121102git.el7            @anaconda
git.x86_64                           1.8.3.1-23.el7_8                  @base
......

[root@k8s-77-166 ~]# yum remove -y git.x86_64

安装新版本git

方式一

使用WANDisco’s CentOS repository安装git

  • 安装repo

    1
    
    [root@k8s-77-166 ~]# yum install -y http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm
  • 安装git

    1
    2
    3
    4
    
    [root@k8s-77-166 ~]# yum install git -y
    
    [root@k8s-77-166 ~]# git version
    git version 2.31.1

方式二

  • 安装repo

    1
    
    [root@k8s-77-166 ~]# yum install -y  https://packages.endpoint.com/rhel/7/os/x86_64/endpoint-repo-1.9-1.x86_64.rpm
  • 安装git

    1
    2
    3
    4
    
    [root@k8s-77-166 ~]# yum install git -y
    
    [root@k8s-77-166 ~]# git version
    git version 2.30.1
Buy me a coffee
支付宝
微信
0%