尝试在 Ubuntu 14.04 上安装 Git

尝试在 Ubuntu 14.04 上安装 Git

我正在尝试在 Ubuntu 14.04 (Trusty Tahr) 上安装 Git...当我输入

sudo apt-get install git-all

它说:

E: Unable to locate package git

于是我跑了:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys E1DD270288B4E6030699E45FA1715D88E1DF1F24
sudo su -c "echo 'deb http://ppa.launchpad.net/git-core/ppa/ubuntu trusty main' > /etc/apt/sources.list.d/git.list"

sudo apt-get update
sudo apt-get install git

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
       Recommends: patch but it is not installable
       Recommends: rsync but it is not installable
       Recommends: ssh-client but it is not installable
E: Unable to correct problems, you have held broken packages.

我该如何修复它,以及我该怎么做才能让它正常工作?

答案1

从下面可以看出,该git-all包在 14.04 上确实存在,并且不是需要 PPA:

andrew@corinth:~$ apt-cache policy git-all
git-all:
  Installed: (none)
  Candidate: 1:1.9.1-1ubuntu0.3
  Version table:
     1:1.9.1-1ubuntu0.3 0
        500 http://au.archive.ubuntu.com/ubuntu/ trusty-updates/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/universe amd64 Packages
     1:1.9.1-1 0
        500 http://au.archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages
andrew@corinth:~$ 

它位于 Ubuntu 存储库的“Universe”部分,因此请确保按照以下步骤激活它:

Dash --> Software & Updates --> Ubuntu Software --> Community maintained....

请参阅此屏幕截图,其中鼠标光标指向适当的存储库:

在此处输入图片描述

激活“Universe”并允许存储库索引重新加载后,摆脱 PPA,然后只需运行:

sudo apt-get install git-all

一切都会好起来的......

相关内容