如何在 Linux 上将 git 更新到最新版本?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19349889/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 09:12:22  来源:igfitidea点击:

How do I update git to its latest version on Linux?

linuxgitubuntuubuntu-11.04

提问by Alice

I have git version 1.7.4.1. and would like to upgrade to the latest stable release of 1.8.4.

我有 git 版本 1.7.4.1。并希望升级到 1.8.4 的最新稳定版本。

So I tried sudo apt-get install gitas it says on the git downloads page for Linuxbut I get this result:

因此,我sudo apt-get install git按照Linuxgit 下载页面上的说明进行了尝试,但得到了以下结果:

  Reading package lists... Done
  Building dependency tree       
  Reading state information... Done
  git is already the newest version.
  0 upgraded, 0 newly installed, 0 to remove and 91 not upgraded.

$ git --version 
  git version 1.7.4.1

and I'm stuck with git version 1.7.4.1!

我坚持使用 git 版本 1.7.4.1!

I am on Ubuntu 11.04.

我在 Ubuntu 11.04 上。

回答by vis.15

This is due to Ubuntu has not updated the package yet in their repositories. The only way around this would be to compile from source, which you can download from https://github.com/git/git.

这是因为 Ubuntu 尚未在其存储库中更新软件包。解决此问题的唯一方法是从源代码编译,您可以从https://github.com/git/git下载。

回答by Nikos C.

There are Ubuntu PPAs for Git, offering the latest version of it. Add one of those and you'll be able to install it. For example:

有适用于 Git 的 Ubuntu PPA,提供它的最新版本。添加其中之一,您就可以安装它。例如:

https://launchpad.net/~git-core/+archive/ppa

https://launchpad.net/~git-core/+archive/ppa

Read the "Adding this PPA to your system" information on how to do this.

阅读有关如何执行此操作的“将此 PPA 添加到您的系统”信息。

回答by Lajos Veres

You should upgrade your whole system to raring at least:

您应该至少将整个系统升级到 raring:

http://packages.ubuntu.com/search?keywords=git-core

http://packages.ubuntu.com/search?keywords=git-core

(If you adhere to packaged version.)

(如果您坚持打包版本。)

But the source will be more fresh anyway.

但无论如何,来源会更新鲜。