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