安装git依赖包

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

删除已有的git

yum remove git

下载git安装包

wget https://www.kernel.org/pub/software/scm/git/git-2.8.3.tar.gz

解压git安装包

tar -zxvf git-2.8.3.tar.gz

配置git安装路径

cd git-2.8.3
./configure prefix=/usr/local/git/

编译并且安装

make && make install

将git指令添加到bash中

vi /etc/profile

在最后一行加入

export PATH=$PATH:/usr/local/git/bin

让该配置文件立即生效

source /etc/profile

查看git版本号

git --version

原文链接:https://miansen.wang/2018/09/04/2/