宅客基地

【技术宅】Linux CentOS系统 Git更新安装

卸载现有Git

yum remove git

2)编译安装最新的git版本

cd /usr/local/src/
wget https://www.kernel.org/pub/software/scm/git/git-2.22.2.tar.xz
tar -vxf git-2.22.2.tar.xz
cd git-2.22.2
make prefix=/usr/local/git all
make prefix=/usr/local/git install
echo "export PATH=$PATH:/usr/local/git/bin" >> /etc/profile
source /etc/profile
git --version
git version 2.22.2

如果是非root用户使用git,则需要配置下该用户下的环境变量

echo "export PATH=$PATH:/usr/local/git/bin" >> ~/.bashrc
source ~/.bashrc
退出移动版