写在前面
- 因centos7自带1.8无法满足需求,故需卸载并重装最新版本git2.9
- 以下安装步骤,如安装后版本未改变,再次执行一遍即可
查看linux版本
lsb_release -a
Distributor ID: CentOS
Description: CentOS Linux release 7.5.1804 (Core)
Release: 7.4.1708
Codename: Core
git下载
选对应的版本
- git2.9安装
- 卸载旧版本
yum remove git
- 安装依赖
- yum install -y curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc xmlto perl-devel perl-CPAN autoconf*
- yum install gcc perl-ExtUtils-MakeMaker
- tar -zxvf git-2.9.x.tar.gz
- cd git-2.9.x
- make configure
- ./configure --prefix=/usr/local/git --with-iconv=/usr/local/libiconv
- make all doc 【约耗时3-5分钟】
- make install install-doc install-html
- echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
- source /etc/bashrc
- 查看版本
gti version