Installing Latest version of git in ubuntu

GitUbuntu

Git Problem Overview


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

Git Solutions


Solution 1 - Git

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

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

sudo apt-get install software-properties-common python-software-properties

Solution 2 - Git

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
    

Solution 3 - Git

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

Solution 4 - Git

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 

Solution 5 - Git

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

Solution 6 - Git

Install Git in Ubuntu

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionArjun Krishna P RView Question on Stackoverflow
Solution 1 - GittessiView Answer on Stackoverflow
Solution 2 - GitDamienView Answer on Stackoverflow
Solution 3 - GitRohit ParteView Answer on Stackoverflow
Solution 4 - Gitmayank1513View Answer on Stackoverflow
Solution 5 - GitKalpesh SoniView Answer on Stackoverflow
Solution 6 - GitPriyadharshini RView Answer on Stackoverflow