无法在 Ubuntu 上更新 Git

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14409639/
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 08:02:45  来源:igfitidea点击:

Unable to update Git on Ubuntu

linuxgitubuntu

提问by Vincent

I am trying to set up Git on an Ubuntu Machine (I'm using a Samsung Chromebook running Ubuntu 12.04).

我正在尝试在 Ubuntu 机器上设置 Git(我使用的是运行 Ubuntu 12.04 的三星 Chromebook)。

When I entered "sudo apt-get install git" and it successfully installed Git 1.79

当我输入“sudo apt-get install git”并成功安装Git 1.79

user@ChrUbuntu:~$ git --version
git version 1.7.9.5

I can't figure out what I am doing wrong here. Any suggestions?

我无法弄清楚我在这里做错了什么。有什么建议?

回答by haley

For new installations of Ubuntu I would first try this to get the latest updates

对于 Ubuntu 的新安装,我会首先尝试此操作以获取最新更新

sudo apt-get dist-upgrade

For more info on this see https://askubuntu.com/questions/81585/what-is-dist-upgrade-and-why-does-it-upgrade-more-than-upgrade

有关这方面的更多信息,请参阅https://askubuntu.com/questions/81585/what-is-dist-upgrade-and-why-does-it-upgrade-more-than-upgrade

That should solve it but if not, add the repository from these guys https://launchpad.net/~git-core/+archive/ppa

那应该可以解决它,但如果没有,请添加这些人的存储库https://launchpad.net/~git-core/+archive/ppa

sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git

This way you don't have to build it, etc.

这样你就不必构建它等。

回答by Steven Penny

Perhaps you need to build for the newest version

也许您需要为最新版本构建

wget git-core.googlecode.com/files/git-1.8.1.1.tar.gz
tar -zxf git-1.8.1.1.tar.gz
cd git-1.8.1.1
make prefix=/usr/local all
sudo make prefix=/usr/local install

回答by Omid Kamangar

If you are trying to upgrade to the latest version of Git, you should do:

如果您尝试升级到最新版本的 Git,您应该执行以下操作:

sudo apt-get update
sudo apt-get upgrade

This will update all your packages, as well as Git.
BTW, latest version of Git on my Kubuntu 12.10 is 1.7.10.4.

这将更新您的所有软件包以及 Git。
顺便说一句,我的 Kubuntu 12.10 上最新版本的 Git 是1.7.10.4.

回答by Harish Garg

A combination of some of the answers worked for me. I did...

一些答案的组合对我有用。我做了...

sudo add-apt-repository ppa:git-core/ppa

须藤添加-apt-repository ppa:git-core/ppa

sudo apt-get update

sudo apt-get 更新

sudo apt-get upgrade

sudo apt-get 升级

回答by Kuya A

In ubuntu 14.04 I tried the terminal code:

在 ubuntu 14.04 中,我尝试了终端代码:

sudo apt-get update
sudo apt-get upgrade

须藤 apt-get 更新
须藤 apt-get 升级

step to upgrade git.

升级git的步骤。

1.) git --version
*to know what git version you had in your computer

2.) sudo apt-get update
*update ubuntu

3.) sudo apt-get upgrade
*to upgrade software including git

4.) try to git --version

1.) git --version
*了解您计算机中的 git 版本

2.) sudo apt-get update
*update ubuntu

3.) sudo apt-get upgrade
* 升级软件,包括 git

4.) 尝试 git - -版本

that's it :)

就是这样 :)

回答by Jan Segre

Have you tried to do an apt-get update? You might have an outdated package list.

你试过做apt-get update吗?您可能有一个过时的软件包列表。