安装必须文件

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

下载git源代码

wget --no-check-certificate https://www.kernel.org/pub/software/scm/git/git-2.1.2.tar.gz

解压并安装

tar xzf git-2.1.2.tar.gz cd git-2.1.2 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

测试

git --version