Git for Ubuntu 12.04.4 LTS

在Ubuntu上安装git,网上查到的命令是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.9.5) but it is not going to be installed
       Depends: git-man (< 1:1.7.9.5-.) but it is not going to be installed
 google-chrome-stable:i386 : Depends: xdg-utils:i386 (>= 1.0.2) but it is not installable
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

看信息像是依赖的包没有安装。于是输入命令:sudo apt-get install liberror-perl
还是不行报错少依赖xdg-utils:i386。再次输入命令
sudo apt-get install xdg-utils:i386,还是不行,信息如下

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package xdg-utils:i386 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 'xdg-utils:i386' has no installation candidate

经过一番调查,解决方法:
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install xdg-utils:i386
sudo apt-get install git

安装完成后,检查是否安装成功

git –version

显示 git version 2.3.4,表明安装成功。
这个方法不仅安装了git,而且是最新版本。
答案来源:http://www.cnblogs.com/zhcncn/p/4030078.html

在这之前我还做了一个操作, sudo gedit /etc/apt/sources.list
插入

deb http:ftp.jp.debian.org/debian sid main

deb http://dl.google.com/linux/deb/ stable non-free main
不过我觉得这个操作应该是多余的。如果你试了上述解决方法还是不行,倒是可以做下这个操作,然后再试试上述解决方法

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值