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
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 仓库
vim /etc/yum.repos.d/wandisco-git.repo
[wandisco-git]
name=Wandisco GIT Repository
baseurl=http://opensource.wandisco.com/centos/7/git/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco
导入存储库GPG密钥
rpm --import http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco
安装git
yum install git
查看版本
[root@tianxin ~]# git version
git version 2.31.1