Git for Ubuntu 12.04.4 LTS

来源:互联网 发布:可以用网络爬虫干什么 编辑:程序博客网 时间:2024/05/05 16:52

在Ubuntu上安装git,网上查到的命令是sudo apt-get install git
但是我的机子不行,信息如下:

Reading package lists... DoneBuilding dependency tree       Reading state information... DoneYou 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 installableE: 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... DoneBuilding dependency tree       Reading state information... DonePackage xdg-utils:i386 is not available, but is referred to by another package.This may mean that the package is missing, has been obsoleted, oris only available from another sourceE: 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
不过我觉得这个操作应该是多余的。如果你试了上述解决方法还是不行,倒是可以做下这个操作,然后再试试上述解决方法

0 0