197

My Current git version 1.7.9.5...

I need to upgrade to at least git 1.7.10 to have git clone command to work properly

I tried sudo add-apt-repository ppa:git-core/ppa for upgrading but resulted in this :

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)?

3
  • 1
    How can I update to a newer version of Git using apt-get? Commented Oct 1, 2013 at 6:54
  • 2
    From the errors/traceback it looks like you have network issue, can you do sudo apt-get update on your machine or go to ppa.launchpad.net/git-core/ppa/ubuntu in your browser? Commented Oct 1, 2013 at 7:02
  • In sudo apt-get update its "Unable to connect to ppa.launchpad.net:http:" but I can go to ppa.launchpad.net/git-core/ppa/ubuntu using my browser Commented Oct 1, 2013 at 8:33

6 Answers 6

383

The Ubuntu git maintainers team has a PPA just 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

Error: Unable to locate package add-apt-repository

If add-apt-repository command is not found, install it first with:

sudo apt-get install software-properties-common

Error: failed to start the dirmngr

If you receive the error:

gpg: failed to start the dirmngr '/usr/bin/dirmngr': No such file or directory

then, install dirmngr with:

sudo apt install dirmngr --install-recommends
Sign up to request clarification or add additional context in comments.

8 Comments

The question was what to do when the first command fails showing the above error
In sudo apt-get update its "Unable to connect to ppa.launchpad.net:http:" but I can go to ppa.launchpad.net/git-core/ppa/ubuntu using my browser. I dont have any clue on what to do with this network error.
Maybe it's a firewall thing? Most corporate networks do nasty things with the internet.
In the update line I'm getting a lot of error 404: W: Failed to fetch us.archive.ubuntu.com/ubuntu/dists/raring-backports/main/… 404 Not Found
Please note that if add-apt-repository fails with "command not found" on your system, you have to run apt-get install python-software-properties first on your Ubuntu
|
27

The question was: "What to do when sudo add-apt-repository ppa:git-core/ppa command fails".

I had the same issue in a VM behind a proxy. I resolved it with the following two steps:

  1. 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>
    
  2. 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
    

2 Comments

export http_proxy and https_proxy worked, but only as root. Running `sudo -E apt-get update' failed: Clearsigned file isn't valid, got 'NODATA'
In my case, the call was hanging trying to make an SSL handshake and didn't print any output. The -E option was the final change that allowed it to work, but I had also set the proxy vars and changed some IPv4 config as per these answers first.
4

Just follow below commands to update latest version of git

sudo add-apt-repository ppa:git-core/ppa -y
sudo apt-get update
sudo apt-get install git -y
git --version

Comments

0

or super manual method

download git source from git hub and then

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

Comments

0

Install Git in Ubuntu

  1. sudo apt-get update
  2. sudo apt-get install git
  3. sudo apt-get install gitk git-gui

Comments

-1

To install or update Git in the latest version of Ubuntu, simply type following command in terminal and hit enter (return).

sudo apt-get install git

For checking Git version.

git --version 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.