git - 无法纠正问题,您持有损坏的软件包

git - 无法纠正问题,您持有损坏的软件包

我无法在 Ubuntu 12.10 上安装 git。我尝试手动将 git 软件包存储库添加到软件源,但在 Ubuntu 12.10 上安装 git-core 时仍然出现以下错误

$ sudo apt-get install git-core
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 git-core : Depends: git (> 1:1.7.0.2)
E: Unable to correct problems, you have held broken packages.

尝试安装 git,但现在显示此错误

$ sudo apt-get install git
[sudo] password for vishak: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
git : Depends: liberror-perl but it is not installable
E: Unable to correct problems, you have held broken packages.

答案1

您不需要向您的存储库添加任何存储库sources.list,因为git自 hardy 以来,任何版本的 ubuntu 都已自带了。

git-core曾经是中央包的旧名称,git从 oneric 开始已被包取代。

最后,aptitude在解决依赖关系时通常会做得更好,因此您可以使用它(并且从命令行来看,语法几乎与 相同apt-get

如果你还没有aptitude安装,请运行

 $ sudo apt-get install aptitude

然后安装 git:

 $ sudo aptitude install git

编辑 从 sources.list 中删除所有多余的行后,您应该刷新包缓存。

$ sudo aptitude update

如果 aptitude 无法找到liberror-perl自 hardy 以来一直存在于 ubuntu 中(并且从那时起从未改变过)的文件,则可能是你的sources.list文件损坏了。

相关内容