在 ubuntu 中安装最新版本的 git
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19109542/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Installing Latest version of git in ubuntu
提问by Arjun Krishna P R
My Current git version 1.7.9.5...
我当前的 git 版本 1.7.9.5 ...
I need to upgrade to at least git 1.7.10 to have git clone
command to work properly
我需要升级到至少 git 1.7.10 才能让git clone
命令正常工作
I tried sudo add-apt-repository ppa:git-core/ppa
for upgrading but resulted in this :
我尝试sudo add-apt-repository ppa:git-core/ppa
升级,但结果是:
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 125, in <module>
ppa_info = get_ppa_info_from_lp(user, ppa_name)
File "/usr/lib/python2.7/dist-packages/softwareproperties/ppa.py", line 80, in get_ppa_info_from_lp
curl.perform()
pycurl.error: (7, "couldn't connect to host")
What am I supposed to do to get the latest git installed (to upgrade)?
我应该怎么做才能安装最新的 git(升级)?
回答by tessi
The Ubuntu git maintainers team has a PPAjust for that
ppa:git-core/ppa
Just do:
做就是了:
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
If add-apt-repository
command is not found, install it first with
如果add-apt-repository
找不到命令,请先安装它
sudo apt-get install software-properties-common python-software-properties
回答by Damien
The question was: "What to do when sudo add-apt-repository ppa:git-core/ppa
command fails".
问题是:“sudo add-apt-repository ppa:git-core/ppa
命令失败时该怎么办”。
I had the same issue in a VM behind a proxy. I resolved it with the following two steps:
我在代理后面的虚拟机中遇到了同样的问题。我通过以下两个步骤解决了它:
Set up proxy environment variables
export http_proxy=http://<user>:<pwd>@<proxy_url>:<port_number> export https_proxy=http://<user>:<pwd>@<proxy_url>:<port_number>
Run the
add-apt-repository
command again as sudo with the-E
option that preserves the user environment:sudo -E add-apt-repository ppa:git-core/ppa
设置代理环境变量
export http_proxy=http://<user>:<pwd>@<proxy_url>:<port_number> export https_proxy=http://<user>:<pwd>@<proxy_url>:<port_number>
add-apt-repository
使用-E
保留用户环境的选项以 sudo 身份再次运行该命令:sudo -E add-apt-repository ppa:git-core/ppa
回答by Kalpesh Soni
or super manual method
或超级手动方法
download git source from git hub and then
从 git hub 下载 git 源,然后
make prefix=/usr/local all
sudo make prefix=/usr/local install
https://www.digitalocean.com/community/tutorials/how-to-install-git-on-ubuntu-14-04
https://www.digitalocean.com/community/tutorials/how-to-install-git-on-ubuntu-14-04
回答by Rohit Parte
Just follow below commands to update latest version of git
只需按照以下命令更新最新版本的 git
sudo add-apt-repository ppa:git-core/ppa -y
sudo apt-get update
sudo apt-get install git -y
git --version