1. 卸载旧git
git --version,可以看到本机自带的git版本是1.7.1(低版本)
yum remove git
2. 安装软件包
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel asciidoc
yum install gcc perl-ExtUtils-MakeMaker
3. 下载git2.2.1并编译安装
wget https://github.com/git/git/archive/v2.2.1.tar.gz
tar -zxvf v2.2.1.tar.gz
cd git-2.2.1/
make prefix=/usr/local/git all
make prefix=/usr/local/git install
4. 配置环境变量
sudo vim /etc/profile
export PATH=$PATH:/usr/local/git/bin
:wq!
source /etc/profile
5 git --version