安装依赖包
本文环境CentOS 6.8 ,默认安装git为1.7.1,实验需要升级git版本
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker -y
卸载旧git
yum remove git -y
下载Git源代码并编译安装
Git source download:https://www.kernel.org/pub/software/scm/git/
wget https://www.kernel.org/pub/software/scm/git/git-2.11.0.tar.gz -P /usr/local/src # 下载git
cd /usr/local/src && tar zxvf git-2.11.0.tar.gz && cd git-2.11.0
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