在Ubuntu 12.04上,Apt-get无法找到`git`软件包。

13

我正在尝试在Ubuntu 12.04上安装git。但是当我输入以下命令时:

sudo apt-get install git

我得到了以下信息。我已经运行过sudo apt-get update

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
However the following packages replace it:
  git-el

E: Package 'git' has no installation candidate
1个回答

29

你需要安装git-core替代原来的软件

sudo apt-get -y install git-core

1
我尝试了这个,但仍然出现错误:正在读取软件包列表... 完成 正在构建依赖关系树
正在读取状态信息... 完成 软件包 git-core 不可用,但是被另一个软件包引用。 这可能意味着该软件包已经丢失、已经过时或者 仅在其他来源中可用 然而,以下软件包可以替换它: git-guiE: 软件包 'git-core' 没有安装候选项
- Shahzeb Khan
请确保您通过“更新管理器”->“设置”窗口启用了主Ubuntu软件包。如果已经启用,但是sudo apt-get update没有帮助,请尝试将git-core ppa添加到您的/etc/apt/sources.list中:deb http://ppa.launchpad.net/git-core/ppa/ubuntu precise main deb-src http://ppa.launchpad.net/git-core/ppa/ubuntu precise main。之后不要忘记运行sudo apt-get update - Konstantin Rudy
2
如果手动安装无法工作:从源文件中删除这些行并运行“sudo add-apt-repository ppa:git-core/ppa”。它应该也会获取密钥。如果有帮助,请告诉我。 - Konstantin Rudy
3
在添加ppa后,您是否执行了“sudo apt-get update”命令? - Konstantin Rudy
我通过在/etc/apt/sources.list中取消注释extras和archive存储库来解决了这个问题。 - dougalg
显示剩余5条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接