git --version
若显示1.8版本则直接删除,版本太低无法使用。
yum -y remove git
依赖安装:
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc
cd /usr/local/src/
进入网址:https://mirrors.edge.kernel.org/pub/software/scm/git/
下载最新版(本地下载使用winscp 放到该目录比较快):
wget https://www.kernel.org/pub/software/scm/git/git-2.9.5.tar.xz
tar -vxf git-2.9.5.tar.xz
cd git-2.9.5.tar.xz
make prefix=/usr/local/git all
make prefix=/usr/local/git install
echo “export PATH=$PATH:/usr/local/git/bin” >> /etc/profile
source /etc/profile
完ok.