git安装错误缺少安装候选者

git安装错误缺少安装候选者,git,ubuntu,Git,Ubuntu,我尝试在Ubuntu12.10上安装git,使用命令sudo-apt-get-install-git。但我收到的错误信息如下: Reading package lists... Done Building dependency tree Reading state information... Done Package git is not available, but is referred to by another package. This may mean that th

我尝试在Ubuntu12.10上安装
git
,使用命令
sudo-apt-get-install-git
。但我收到的错误信息如下:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package git is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'git' has no installation candidate
deb http://archive.ubuntu.com/ubuntu precise main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu precise-updates main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu precise-security main restricted universe multiverse

我应该做些什么呢?

我在ubuntu 12上找到了一本关于git的不错的教程

它主要提到了安装前的依赖项:

sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev build-essential
要将其用于git安装,请执行以下操作: sudo-apt-get-install-git-core sudoapt获得更新

它还说: 安装后,您可以从google代码页下载最新版本的Git

wget https://git-core.googlecode.com/files/git-1.8.1.2.tar.gz
下载后,卸载文件并切换到该目录:

tar -zxf git-1.8.1.2.tar.gz
cd git-1.8.1.2

如果要执行全局安装,请使用sudo前缀以自己和root身份安装一次:

make prefix=/usr/local all
sudo make prefix=/usr/local install
如果将来需要更新Git,可以使用Git本身来完成

git clone git://git.kernel.org/pub/scm/git/git.git

去查看教程并给她留下评论;-)

git包应该是可安装的。原则上,如果发生类似情况,您应该验证以下内容

  • 确保
    /etc/apt/sources.list
    文件的内容正常。它应该包含如下内容:

    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Package git is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    
    E: Package 'git' has no installation candidate
    
    deb http://archive.ubuntu.com/ubuntu precise main restricted universe multiverse
    deb http://archive.ubuntu.com/ubuntu precise-updates main restricted universe multiverse
    deb http://security.ubuntu.com/ubuntu precise-security main restricted universe multiverse
    
  • 在尝试安装git之前,请确保您已经运行了apt get update

请注意,上述来源列表用于精确(12.04)。12.10被称为量子。但请注意,12.10不再受支持(EOL为2014年5月-见)。因此,您的问题的解决方案可能是,服务器上不再存在12.10的包源,因此消息实际上是正确的:服务器上不再有候选包了


解决方案是至少升级到下一个LTS版本(14.04)。

尝试运行以下命令

sudo rm -vf /var/lib/apt/lists/*
sudo apt-get update

首先运行此命令以更新

sudo apt update 
然后运行这个

sudo apt-get install git

我也有这个问题。在“软件和更新”中,未选中Canonical支持的免费开源软件(main),并在“可从CD-ROM/DVD安装”部分下选中该框,导致apt在不存在的光盘驱动器上查找该软件包。

不必从源安装git。在我刚刚安装的Ubuntu盒(12.04)中,我可以简单地
apt-install-git
,它将引入所有必需的依赖项,包括git-core等。我想你是对的,但OP就是这么做的,失败了。所以我放了一些谷歌搜索结果(出于什么原因:-),但我放了。)对于您对/etc/apt/sourcesthanks的评论,我给出+1。把它变成了答案。实际答案可能是12.10是EOL…:)在新安装的Ubuntu 12.04上,我可以简单地
安装git
,它将安装git及其所有依赖项。(我没有尝试过12.10,但14.04是相同的,我认为在同一时间没有更改。)因此我假设您的设置有问题:-您是否运行了apt get update?-你的/etc/apt/sources.list是什么样子的?Ubuntu 12.10不再受支持,因此软件存储库也不再受支持。@Trengot:没错,请看下面我的答案。嘿,我在16.10上也面临同样的问题。我试过这样做。但它不起作用。还有其他解决方案吗?嘿,我在16.10遇到了同样的问题。我试过这样做。但它不起作用。还有其他的解决办法吗?经过广泛的搜索,我终于找到了解决办法。谢谢你发布这个!