参考:http://www.cnblogs.com/qtiger/p/9290897.html
下载git包https://mirrors.edge.kernel.org/pub/software/scm/git/
本博主下载的是2.7.4
上传到指定目录下,并解压tar –zxvf git-2.7.4.tar.gz
# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc
# yum install gcc perl-ExtUtils-MakeMaker
1)如果有自带版本请卸载系统自带的低版本git
# git --version
git version 1.8.3
# yum remove git
2)编译安装最新的git版本
# cd /usr/local/src/
# wget https://www.kernel.org/pub/software/scm/git/git-2.7.4.tar.xz 下载git-2.7.4.tar.xz压缩包
# tar -vxf git-2.7.3.tar.xz 解压缩
# cd git-2.7.3
# make prefix=/usr/local/git all 编译
# make prefix=/usr/local/git install 安装
# echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile 加git到环境变量
# source /etc/profile
# git --version
git version 2.7.4