git git安装错误缺少安装候选
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30932121/
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
git installation error missing installation candidate
提问by Niya Simon C
I tried installing git
on Ubuntu 12.10 using the command sudo apt-get install git
. But I am getting error message like this:
我尝试git
使用命令在 Ubuntu 12.10 上安装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
What am I supposed to do further?
我应该进一步做什么?
回答by andgursky
Try running below commands.
尝试运行以下命令。
sudo rm -vf /var/lib/apt/lists/*
sudo apt-get update
回答by Michael Adam
The git package should be installable. In principle if something like this occurs, you should verify the following.
git 包应该是可安装的。原则上,如果发生这种情况,您应该验证以下内容。
Make sure that the contents of your
/etc/apt/sources.list
file is sane. It should contain something like this: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
Make sure you have run
apt-get update
before trying to install git.
确保
/etc/apt/sources.list
文件的内容是正常的。它应该包含如下内容: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
apt-get update
在尝试安装 git 之前,请确保您已运行。
Note that the above sources.list is for precise (12.04). 12.10 is called quantal. But note that 12.10 is not supported any more(EOL was May 2014 - see here). So the solution to your problem might be that the package sources for 12.10 don't exist any more on the server, so the message is in fact correct: on the server there simply is no candidate any more...
请注意,上面的 sources.list 是为了精确 (12.04)。12.10 被称为量子。但请注意,不再支持12.10 (EOL 是 2014 年 5 月 - 请参阅此处)。因此,您的问题的解决方案可能是服务器上不再存在 12.10 的包源,因此该消息实际上是正确的:在服务器上根本就没有候选人了...
The solution would then be to upgrade to at least the next LTS version (14.04).
解决方案是至少升级到下一个 LTS 版本 (14.04)。
回答by Marco M. von Hagen
I found a nice tutorial about git on ubuntu 12 here.
我在这里找到了一个关于 ubuntu 12 上的 git 的很好的教程。
It mainly mentioned the dependencies prior to install:
主要提到了安装之前的依赖:
sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev build-essential
and to use this for the git installation: sudo apt-get install git-core sudo apt-get update
并将其用于 git 安装: sudo apt-get install git-core sudo apt-get update
and further more it says: Once they are installed, you can download the latest version of Git from the google code page.
更进一步说:安装它们后,您可以从谷歌代码页下载最新版本的 Git。
wget https://git-core.googlecode.com/files/git-1.8.1.2.tar.gz
After it downloads, untar the file and switch into that directory:
下载后,解压文件并切换到该目录:
tar -zxf git-1.8.1.2.tar.gz
cd git-1.8.1.2
cd git-1.8.1.2
If you want to do a global install, install it once as yourself and once as root, using the sudo prefix:
如果要进行全局安装,请使用 sudo 前缀以自己和 root 身份安装一次:
make prefix=/usr/local all
sudo make prefix=/usr/local install
If you need to update Git in the future, you can use Git itself to do it.
如果以后需要更新 Git,可以使用 Git 本身来做。
git clone git://git.kernel.org/pub/scm/git/git.git
Go and check the tutorial and leave her a comment ;-)
去检查教程并给她留下评论;-)