centos升级git至最新版本

Posted in 2016-12-26 14:56 | Category: Linux | Tags: centos git linux

原因

centos默认git 版本 1.7.1

$ git clone

时报错:

The requested URL returned error: 401 Unauthorized while accessing

无法使用http + username + password 方式

升级

下载源码

https://www.kernel.org/pub/software/scm/git/

$ wget https://www.kernel.org/pub/software/scm/git/git-2.11.0.tar.xz
$ tar xvf git-2.11.0.tar.xz

编译

$ sudo mkdir -p /opt/git
$ cd git-2.11.0
$ ./configure --prefix=/opt/git/
$  make
$  sudo yum remove git
$ sudo make install

修改.bashrc

export PATH=$PATH:/opt/git/bin

然后

$ source .bashrc

ok,查看版本

$ git --version
git version 2.11.0