Installing Latest version of git in ubuntu Installing Latest version of git in ubuntu git git

Installing Latest version of git in ubuntu


The Ubuntu git maintainers team has a PPA just for that

ppa:git-core/ppa

Just do:

sudo add-apt-repository ppa:git-core/ppasudo apt-get updatesudo 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


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


Just follow below commands to update latest version of git

sudo add-apt-repository ppa:git-core/ppa -ysudo apt-get updatesudo apt-get install git -ygit --version