先去官网看看 Download for Linux and Unix:
代码语言:javascript复制RHEL and derivatives typically ship older versions of git. You can download a tarball and build from source, or use a 3rd-party repository such as the [IUS Community Project](https://ius.io/) to obtain a more recent version of git.
RHEL 和衍生通常提供较老版本的 git。您可以下载 tarball 并从源代码构建,或者使用第三方存储库,如 IUS Community Project 来获得最新版本的 git。
使用 IUS
RHEL/CentOS 7
代码语言:javascript复制yum install
https://repo.ius.io/ius-release-el7.rpm
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
安装新版 git:
ius 通常会在高版本的软件名后面 u
代码语言:javascript复制yum list git
如果你已经装有低版本的 git,你需要先 remove(否则安装的时候会报错)
代码语言:javascript复制yum remove git
安装 2.0 以上版本的 git
代码语言:javascript复制yum install git2u
WANdisco
另一个源:WANdisco Replication Binaries
代码语言:javascript复制sudo vi /etc/yum.repos.d/wandisco-git.repo
wandisco-git.repo
代码语言:javascript复制[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
Import the repository GPG keys with:
代码语言:javascript复制sudo rpm --import http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco
代码语言:javascript复制sudo yum remove git
sudo yum install git
git --version
References
- How To Install Git on CentOS 7 | linuxize
- How to install latest version of git on CentOS 7.x/6.x | stackoverflow
– EOF –
- # centos
- # git