0.安装gcc
yum install gcc
yum install gcc-c++
1.安装所需软件包
# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
# yum install gcc perl-ExtUtils-MakeMaker
2.下载&安装
# cd /usr/src
# wget https://www.kernel.org/pub/software/scm/git/git-2.7.3.tar.gz
# tar xzf git-2.7.3.tar.gz
# cd git-2.7.3
# 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
3.检查版本
# git --version
*其他
安装新版本之前需要使用# yun remove git卸载。
执行make prefix=/usr/local/git all时,可能会报错:make: * [git-credential-store] Error 1,此时可以使用以下命令代替
# ./configure --without-iconv
# make CFLAGS=-liconv prefix=/usr/local/git all
# make CFLAGS=-liconv prefix=/usr/local/git install