• 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。

    参考站点

  • 相关阅读:
    Spring基于注解整合Redis实现内容缓存
    配置Mybatis二级缓存为Redis来实现内容缓存
    Spring整合Redis
    Java连接redis
    机器学习之 KNN近邻算法(一)入门
    matplotlib 之 快速入门
    Pandas 之入门
    Hadoop 之 环形缓冲区原理
    numpy 之 rollaxis的理解
    python 之 遇到SyntaxError: Non-UTF-8 code starting with 'xb8' in file
  • 原文地址:https://www.cnblogs.com/autohome7390/p/7823021.html
Copyright © 2020-2023  润新知