无法安装git - Unmet依赖项错误(Ubuntu 11.10)

时间:2013-05-29 17:58:53

标签: git install

当我尝试安装git(sudo apt-get install git)时,出现以下错误:

root@ServerC--Frrole2:/usr/tomcat/apache-tomcat-7.0.25# sudo apt-get install git
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 git : Depends: liberror-perl but it is not going to be installed
       Depends: git-man (> 1:1.7.5.4) but it is not going to be installed
       Depends: git-man (< 1:1.7.5.4-.) but it is not going to be installed
 sun-java6-jre : Depends: sun-java6-bin (>= 6.26-2natty1) but it is not going to be installed or
                          ia32-sun-java6-bin (>= 6.26-2natty1) but it is not going to be installed
                 Recommends: gsfonts-x11 but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

如果有人知道如何解决这个问题,请帮助!

编辑:


现在,在运行了更多命令之后。我得到了以下状态。

root@ServerC--Frrole2:/usr/tomcat/apache-tomcat-7.0.25# apt-get install git
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: The package sun-java6-jre needs to be reinstalled, but I can't find an archive for it.

我不知道安装git与安装Java有什么关系。我已经用tomcat安装了java。

root@ServerC--Frrole2:/usr/tomcat/apache-tomcat-7.0.25# which java
/usr/tomcat/jdk1.7.0_02/bin/java

4 个答案:

答案 0 :(得分:1)

修改/etc/apt/sources.list

添加此内容:

deb http://ftp.ca.debian.org/debian/ jessie main contrib non-free
deb-src http://ftp.ca.debian.org/debian/ jessie main contrib non-free

deb http://security.debian.org/ jessie/updates main contrib non-free
deb-src http://security.debian.org/ jessie/updates main contrib non-free

deb http://ftp.ca.debian.org/debian/ jessie-updates main contrib non-free
deb-src http://ftp.ca.debian.org/debian/ jessie-updates main contrib non-free

deb http://ftp.ca.debian.org/debian/ jessie-backports main contrib non-free

更新系统:

apt-get update

apt-get upgrade

安装git:

apt-get install git

答案 1 :(得分:0)

您是否尝试按输出建议运行'apt-get -f install'?

另外,看一下这个,sun-java6一般来说不再可用。运行上一个命令后,再试一次,它应该尝试打开jdk而不是

答案 2 :(得分:0)

您可以尝试其他存储库。我遇到了同样的问题,我刚刚切换到存储库“主服务器”。没关系

答案 3 :(得分:-1)

我也遇到了同样的问题,我按照以下方式解决了这个问题。

  1. 我升级了所有套餐(see this Ask Ubuntu question
  2. 我经历了How do I resolve unmet dependencies after adding a PPA?
  3. 我运行了git安装命令(apt-get install git