1、取代 yum 安装的低版本 git
yum remove git*
2、下载最新安装包,可以去官网看看最新的是什么版本,我所处的年代是2.18.0
wget https://www.kernel.org/pub/software/scm/git/git-2.18.0.tar.gz
3、 解压
tar -zxvf git-2.18.0.tar.gz
4、进入解压目录
cd git-2.18.0
(先安装这个,否则执行git clone https://..会报错)
yum install curl-devel
5、安装
./configure --prefix=/usr/local/git-2.18.0
make
make install
报错
(1)zlib错误
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
(2) expat.h
yum install expat-devel
(3)
yum install perl-ExtUtils-MakeMaker
(4) openssl/ssl.h
yum install openssl-devel
6、建立软链
ln -s /usr/local/git-2.18.0/bin/* /usr/bin/
7、查看版本
git --version
8、如果版本不对,把加到最后
export PATH=/usr/local/git-2.18.0/bin:$PATH
9、激活环境变量
source /etc/profile
网友评论