Note when going straight for success of Mr.Wang

0%

Linux命令安装Git

Linux(Centos7.6)安装git2.17.0

  1. 下载链接:https://github.com/git/git/archive/v2.17.0.tar.gz
  2. 解压:

    1
    tar -zxvf v2.17.0.tar.gz
  3. 安装依赖:

    1
    yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
  4. 安装依赖时,yum自动安装了Git,需要卸载旧版本Git

    1
    yum remove git #出现提示输入y即可
  5. 编译

    1
    cd git-2.17.0 & make prefix=/usr/local/git all
  6. 安装Git至/usr/local/git路径

    1
    make prefix=/usr/local/git install
  7. 配置环境变量

    1
    2
    3
    vim /etc/profile
    export PATH=$PATH:/usr/local/git/bin
    source /etc/profile
  8. 查看安装的git版本,有版本,安装成功

    1
    git --version
-------------the end-------------