git二進制文件下載地址:
https://mirrors.edge.kernel.org/pub/software/scm/git/
1.下載v2.21.0版本
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.21.0.tar.gz
2.安裝依賴
yum -y install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker
3.解壓
tar -zxvf git-2.21.0.tar.gz
4.進入解壓目錄
5.編譯
make prefix=/usr/local/git all
6.安裝Git在/usr/local/git路徑
make prefix=/usr/local/git install
7.配置環境變量
# 編輯環境配置文件
vim /etc/profile
# 末尾添加
export PATH=/usr/local/git/bin:$PATH
# 生效
source /etc/profile
8.git version 查看安裝的git版本,校驗通過,安裝成功