Linux 下 Git版本升级

一、下载需要安装的版本号

wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.24.0.tar.gz

二、安装需求

yum install curl-devel expat-devel gettext-devel     openssl-devel zlib-devel

三、卸载Centos自带的git:

yum remove git
git --version

四、安装

tar -zxf git-2.24.0.tar.gz
cd git-2.24.0
make prefix=/usr/local/git all
make prefix=/usr/local/git install

五、添加环境变量

vim /etc/profile
 	   export PATH=$PATH:/usr/local/git/bin
source  /etc/profile

六、查看版本号

git --version
git version 2.24.0

附:
centos默认的的yum仓库中的默认版本很低,有时我们需要安装高版本git,编译安装又太麻烦。
下面介绍一种yum安装高版本git的方法

1,安装 WANDisco 仓库包

安装 centos6 WANDisco 仓库
yum install http://opensource.wandisco.com/centos/6/git/x86_64/wandisco-git-release-6-1.noarch.rpm

安装 centos7 WANDisco 仓库
yum install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm

2,安装 Git
yum -y install git
3,版本验证
git version
centos7 安装快捷复制
yum install http://opensource.wandisco.com/centos/7/git/x86_64/wandisco-git-release-7-2.noarch.rpm
yum -y install git
git version

yum install nss

posted @ 2021-03-01 15:02  武兴旺  阅读(2713)  评论(0编辑  收藏  举报