centos7 安装高版本git

系统centos7,默认安装的git版本是1.8,在使用code server、jenkins等软件时,偶尔提示失败。原因是git版本太低。接下来,我们升级git。

1、卸载:

git --version
git version 1.8.3


yum remove git

2、下载:

https://git-scm.com/ download界面选择操作系统类型,下载。在linux上,基本提供的是源码编译安装。

cd /usr/local/src
wget https://www.kernel.org/pub/software/scm/git/git-2.27.0.tar.gz
tar -xvzf git-2.27.0.tar.gz

cd git-2.27.0

3、安装:

pwd
/usr/local/src/git-2.27.0

make prefix=/usr/local/git all

这一步可能会报如下错误:

http.h:6:23: fatal error: curl/curl.h: No such file or directory
 #include 

解决方法:

yum install curl-devel -y

接下来:

 make prefix=/usr/local/git install

没有问题后,配置环境变量:

$ echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile
$ source /etc/profile
$ git --version
git version 2.27.0


 

你可能感兴趣的:(git工具)