Centos6.X升级git

in Git with 0 comment

Centos 6自带Git版本为1.7.1,连基本的clone或者push都无法做到,只好手动升级Git版本。

1. 安装编译git时所需要的包

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
yum install  gcc perl-ExtUtils-MakeMaker

2. 删除现有版本Git

yum remove git

3. 下载git并添加到环境变量中

cd /usr/src
wget https://www.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz
tar -zxvf git-2.9.5.tar.gz

4. 编译安装

cd git-2.9.5
make prefix=/usr/local/git all
make prefix=/usr/local/git install
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/bashrc
source /etc/bashrc

5. 检查git版本

git --version
Responses