https://github.com/git/git/tags在這里選擇版本下載
wget https://github.com/git/git/archive/v2.28.0.tar.gz
然后解壓
tar -zxvf v2.28.0.tar.gz
cd git-2.28.0
make configure #生成配置文件,如果報autoconf錯 ,請先安裝 yum install install autoconf automake libtool
./configure --prefix=/usr/local/git
make && make install
yum remove git #刪除舊的git
vim /etc/profile #配置環境變量
#在大概52行加入
GIT_HOME=/usr/local/git
PATH=$PATH:$GIT_HOME/bin
source /etc/profile #刷新