Centos6.5安装git

安装编译git时需要的包
1
2
3
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel

yum install gcc perl-ExtUtils-MakeMaker
删除已有的git
1
yum remove git
下载git源码

地址:https://www.kernel.org/pub/software/scm/git/ 选择要安装的版本

1
2
3
cd /opt/local/src
wget https://www.kernel.org/pub/software/scm/git/git-x.x.x.tar.gz
tar xzf git-x.x.x.tar.gz
编译安装
1
2
3
4
5
cd git-x.x.x
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
检查一下版本号
1
git --version