在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
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
看信息像是依赖的包没有安装。于是输入命令:sudo apt-get install liberror-perl
还是不行.
经过一番调查,解决方法:
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install xdg-utils:i386
sudo apt-get install git
安装完成后,检查是否安装成功
shenfl@shenfl-OptiPlex-9020:~$ git --version
git version 2.8.1
显示 git version 2.8.1,表明安装成功。
这个方法不仅安装了git,而且是最新版本。
Attention: 在这之前做了一个操作, 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