下载地址
https://github.com/git/git/releases
下载到/usr/local/software目录
cd /usr/local/software
wget https://github.com/git/git/archive/v2.18.0.tar.gz
安装依赖
yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
tar -zxvf v2.18.0.tar.gz
cd git-2.18.0
编译
make prefix=/usr/local/git all
安装Git在/usr/local/git路径
make prefix=/usr/local/git install
配置环境变量
vim /etc/profile
末尾添加
export PATH=/usr/local/git/bin:$PATH
立马使配置生效
source /etc/profile
查看安装的git版本
git version