1,下載源碼
wget https://github.com/git/git/archive/v2.26.0.tar.gz
2.解壓
tar -zxvf v2.26.0.tar.gz
3.進入解壓目錄
cd git-2.26.0
4.編譯
make prefix=/usr/local/git all
5.安裝
make prefix=/usr/local/git install
6.設置環境變量,編輯文件 vi /etc/profile,末尾添加如下內容,保存退出
export PATH=$PATH:/usr/local/git/bin
7.使環境變量生效,執行下面命令
source /etc/profile
8.驗證git版本
git --version