zoukankan      html  css  js  c++  java
  • centos7.4 update git

    1. 查看 yum 源仓库的 Git 信息:

    yum info git
    

    输入如下内容:

    Available Packages
    Name        : git
    Arch        : x86_64
    Version     : 1.8.3.1
    Release     : 12.el7_4
    Size        : 4.4 M
    Repo        : updates/7/x86_64
    Summary     : Fast Version Control System
    URL         : http://git-scm.com/
    License     : GPLv2
    Description : Git is a fast, scalable, distributed revision control system with
                : an unusually rich command set that provides both high-level
                : operations and full access to internals.
                : 
                : The git rpm installs the core tools with minimal dependencies.  To
                : install all git packages, including tools for integrating with
                : other SCMs, install the git-all meta-package.
    

     可以看出,截至目前,yum 源仓库中最新的 Git 版本才 1.8.3.1,而查看最新的 Git 发布版本,已经 2.15.0 了。

    2. 依赖库安装

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

    3. 卸载低版本的 Git

    通过命令:git –-version 查看系统带的版本,Git 版本是: 1.8.3.1,所以先要卸载低版本的 Git,命令:

    yum remove git
    

    4. 下载新版的 Git 源码包

    wget https://github.com/git/git/archive/v2.15.0.tar.gz
    

    5. 解压

    tar -xzvf v2.15.0.tar.gz
    

    6. 安装 Git

    分别执行以下命令进行编译安装,编译过程可能比较漫长,请耐心等待完成。

    cd git-2.15.0
    make prefix=/usr/local/git all
    make prefix=/usr/local/git install
    

    7. 添加到环境变量

    echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
    source /etc/bashrc # 实时生效
    

    8. 查看版本号

    git --version
    

    输出:

    git version 2.15.0
    

     至此,CentOS 就安装上了最新版本的 Git。

    参考站点

  • 相关阅读:
    [杂七杂八][高效程序员应该养成的七个习惯][转载]
    链表反转,只用两次头插法就实现了 hello
    清除空格 hello
    单词计数 hello
    单词查找程序 hello
    sdut 超级玛丽
    ural Episode Nth: The Jedi Tournament(缩点+建树)
    sudt 括号东东(模拟题)
    ural Pilot Work Experience(dfs + bfs )
    ural Team building(强连通分支)
  • 原文地址:https://www.cnblogs.com/autohome7390/p/7823021.html
Copyright © 2011-2022 走看看