centos git 升级

  1. 查看旧git版本 git --version

    git version 1.8.3.1

  2. 卸载git

    yum remove git

  3. 安装git编译需要的包

    yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc
    yum install gcc perl-ExtUtils-MakeMaker

  4. https://mirrors.edge.kernel.org/pub/software/scm/git/ 地址找最新的版本 这里选择git-2.9.5.tar.xz版本

    cd /usr/local/src/
    wget https://www.kernel.org/pub/software/scm/git/git-2.9.5.tar.xz

  5. 解压

    tar -vxf git-2.9.5.tar.xz
    cd git-2.9.5

  6. 编译安装

    make prefix=/usr/local/git all
    make prefix=/usr/local/git install

  7. 添加到配置文件

    echo “export PATH=$PATH:/usr/local/git/bin” >> /etc/profile
    source /etc/profile

  8. 查看版本 git --version

    git version 2.9.5

猜你喜欢

转载自blog.csdn.net/liuxiaoming1109/article/details/82993924