1.下載git包
下載網址:https://mirrors.edge.kernel.org/pub/software/scm/git/ //自己下載想要的版本
或者直接在Linux 直接使用wget下載
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.21.0.tar.gz
3.tar解壓git包
4.安裝到指定目錄 /usr/local/git/
5.編譯安裝,這里編譯安裝失敗,提示zlib.h錯誤,需要安裝zlib
安裝zlib
yum install zlib-devel
6.執行make ;make install 完成安裝
7.查看安裝完的版本,正常