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源码,我自己下载的是2.9.1版本的下载地址:http://pan.baidu.com/s/1qXFnOxI
# cd /opt/setups //随意进入哪个目录,用来下载git使用
# wget https://www.kernel.org/pub/software/scm/git/git-2.9.1.tar.gz
# tar xzf git-2.9.1.tar.gz
4.编译安装
# cd git-2.9.1
# ./configure --prefix=/usr/program/git_2.9.1 //安装git的目录
# make
# make install
5.创建软连接
# ln -s /usr/program/git_2.9.1/bin/* /usr/bin/ //如果安装在/usr/local下系统环境变量无需要做软链接
6.测试git
# git --version