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。

    参考站点

  • 相关阅读:
    codeforces 719A:Vitya in the Countryside
    POJ3233 Matrix Power Series
    codevs1409 拦截导弹2
    BZOJ1562 [NOI2009]变换序列
    POJ1325 Machine Schedule
    codeforces 715B:Complete The Graph
    BZOJ1972:[SDOI2010]猪国杀
    浅谈模拟
    BZOJ2548:[CTSC2002]灭鼠行动
    BZOJ1033:[ZJOI2008]杀蚂蚁
  • 原文地址:https://www.cnblogs.com/autohome7390/p/7823021.html
Copyright © 2011-2022 走看看