1、卸載舊版本
yum -y remove git
2、下載新版本
前往:https://mirrors.edge.kernel.org/pub/software/scm/git/ 獲取要升級的版本
右鍵複製下連接地址
3、安裝
下載:
cd /home && wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.9.5.tar.gz --no-check-certif
解壓縮:
tar -xzvf git-2.9.5.tar.gz
安裝:
cd git-2.9.5 && make prefix=/usr/local/git all && make prefix=/usr/local/git install
配置環境變量:
vim /etc/profile
在 export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL 後邊追加:
#Git
export PATH=$PATH:/usr/local/git/bin
重新加載環境變量:
source /etc/profile
驗證git版本:
git --version