先用 yum 安装依赖

yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
yum install gcc perl-ExtUtils-MakeMaker

卸载 centos自带的 git 1.7.1

通过 git –version 查看系统带的版本,cento6.5 应该自带的是 git 版本是 1.7.1
yum remove git

下载 git 2.18.0 版本

cd /usr/local/webserver
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.18.0.tar.gz
tar xzf git-2.18.0.tar.gz

安装 git 并添加到环境变量中

cd git-2.18.0
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

文章目录