官方教程,在 Linux/Unix 系统中,通过工具在中安装 git,这种方式比较简单,便于升级卸载工具,网上搜到的全是源码编译安装。下面介绍在 CentOS 系统中,通过 yum 来安装 gitRed Hat Enterprise Linux, Oracle Linux, CentOS, Scientific Linux, et al.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 to obtain a more recent version of git.官方文档说 git 在 RHEL 和衍生产品通常都会发布旧版本的 git,我们需要源码编译安装,或者使用第三方存储库(如IUS社区项目)。现在我们通过,IUS社区下载 ius-release.rpm 文件进行安装# 注意下载不同的版本,本机 CentOS 7wget https://centos7.iuscommunity.org/ius-release.rpm# 安装rpm文件rpm -ivh ius-release.rpm查看可安装的git安装包repoquery –whatprovides git# git-0:1.8.3.1-13.el7.x86_64# git2u-0:2.16.5-1.ius.centos7.x86_64# git2u-0:2.16.2-1.ius.centos7.x86_64# git2u-0:2.16.4-1.ius.centos7.x86_64# git-0:1.8.3.1-14.el7_5.x86_64卸载我本机的 1.8.3 的 git,安装 2.16.5 的 git# 卸载老的版本yum remove git# 安装新的版本yum install git2u原文收录在这里