centos yum升级git

服务器上的git版本太低,很多东西不能用了,要升级

(1) 卸载之前的git

git --version
git version 1.7.1
yum remove git

(2) 安装依赖的包

yum update
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel 

(3) 下载git源码并解压缩

wget https://github.com/git/git/archive/v2.12.2.tar.gz
tar -zxvf v2.12.2.tar.gz

(4) 编译安装

cd git-2.12.2

make configure
./configure --prefix=/usr/local/git
make profix=/usr/local/git
make install

(5) 将git安装路径添加到PATH变量或者软链也行

不写了

你可能感兴趣的:(centos yum升级git)