先去官网看看 Download for Linux and Unix:
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
yum install \ |
安装新版 git:
ius 通常会在高版本的软件名后面 + u
yum list git |
如果你已经装有低版本的 git,你需要先 remove(否则安装的时候会报错)
yum remove git |
安装 2.0 以上版本的 git
yum install git2u |
WANdisco
另一个源:WANdisco Replication Binaries
sudo vi /etc/yum.repos.d/wandisco-git.repo |
wandisco-git.repo
[wandisco-git] |
Import the repository GPG keys with:
sudo rpm --import http://opensource.wandisco.com/RPM-GPG-KEY-WANdisco |
sudo yum remove git |
References
- How To Install Git on CentOS 7 | linuxize
- How to install latest version of git on CentOS 7.x/6.x | stackoverflow
– EOF –