1、下载并解压
cd /data/git
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz
tar -zxvf git-2.9.5.tar.gz
2、编译和安装
cd git-2.9.5
make prefix=/data/git/git all
make prefix=/data/git/git install
注意
如果make失败,请执行清理命令:
make distclean
需要的依赖
#yum install openssl
yum install openssl-devel
yum -y install curl-devel
yum install expat-devel
yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
3、添加环境变量
vim /etc/profile
export PATH=$PATH:/data/git/git/bin
source /etc/profile
4、验证是否安装成功
git --version