Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
git安装错误缺少安装候选者_Git_Ubuntu - Fatal编程技术网

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

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

我在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)。

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 rm -vf /var/lib/apt/lists/*
sudo apt-get update

首先运行此命令以更新

sudo apt update 
然后运行这个

sudo apt-get install git

首先运行此命令以更新

sudo apt update 
然后运行这个

sudo apt-get install git

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

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

在“系统设置/软件和更新”中未选中所有选项时,我出现此错误禁用自动更新时。
重新选中“Ubuntu软件”和“其他软件”中的所有复选框修复了该问题。

在禁用自动更新的同时取消选中“系统设置/软件和更新”中的所有选项时,我出现了此错误。
重新选中“Ubuntu软件”和“其他软件”中的所有复选框修复了该问题。

不必从源代码安装git。在我刚刚安装的Ubuntu盒(12.04)中,我可以简单地
apt-install-git
,它将引入所有必需的依赖项,包括git-core等。我想你是对的,但OP就是这么做的,失败了。所以我放了一些谷歌搜索结果(出于什么原因:-),但我放了。)对于您对/etc/apt/sourcesthanks的评论,我给出+1。把它变成了答案。实际答案可能是12.10是EOL…:)不必从源代码安装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上也面临同样的问题。我试过这个