在 CentOS 中更新到最新的 git 版本 2.2.x

Update to latest git version 2.2.x in CentOS

以下是当前版本。

git --version
git version 2.1.0

如何在 CentOS 中更新到最新的 git 版本 2.2.x。 yum install git 说它是 Linux AMI 实例上的最新版本。

您拥有 git 的新版本令人惊讶。这不是为 CentOS 6 或 7 正式打包的。

CentOS 6 附带 git 1.7.1.

CentOS 7 附带 1.8.3.1。

要获得更新版本的 git,您需要找出您从哪里获得了 "new" 版本的 git,看看他们是否有更新。亚马逊本可以自己打包更新版本,但可能尚未更新该包。

yum info git 的输出(来自评论):

$ yum info git
Loaded plugins: priorities, update-motd, upgrade-helper
Installed Packages
Name : git
Arch : x86_64
Version : 2.1.0
Release : 1.35.amzn1
Size : 22 M
Repo : installed
From repo : amzn-main
Summary : Fast Version Control System
URL : git-scm.com
License : GPLv2
Description : Git is a fast, scalable, distributed revision control system with an
            : unusually rich command set that provides both high-level operations
            : and full access to internals.

看来亚马逊自己打包了 git 2.1 版,如果 yum update 没有给你更新的版本,那么他们就没有打包任何更新的版本。

Amazon Linux AMIrelease notes 页面似乎同意这一点。

git 的文档中指出,对于 RHEL 和 CentOS,我们必须从源代码构建它以获得最新版本。