1.首先卸载CentOS自带的git1.7.1:
通过git –version查看系统带的版本,Cento6.5应该自带的是git版本是1.7.1
># yum remove git
2.安装编译git时需要的包
># yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
># yum install gcc perl-ExtUtils-MakeMaker
3.从github下载最新的源码
># wget https://github.com/git/git/archive/v2.8.2.tar.gz
># tar zxvf v2.8.2.tar.gz
># cd git-2.8.2
4.编译安装
># cd git-2.8.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
5.查看当前版本
># git --version
>git version 2.8.2