This question already has an answer here:

I'm currently on ubuntu 12.04 and since this is an older version of ubuntu i have git 1.7.9.5 installed and i'm not sure how i can upgrade this to git 2.x.

  • what do i type to install git 2.x (sudo apt-get install git)?
  • when installing git 2.x, does it overwrite git 1.7? if not how do you choose which one to use?
  • how do i find out where git 1.7 is installed on my system?
share|improve this question

marked as duplicate by muru, karel, Eric Carvalho, Pandya, Fabby Jan 16 '15 at 0:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 4 down vote accepted

If the add-apt-repository command doesn't work, you need to add the python-software-properties package first. Combined you would do:

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git
git --version
share|improve this answer
    
You also need to run sudo apt-get install software-properties-common for apt-add-repository to work. – Rob Sanders Sep 27 '16 at 14:26

There is a Git PPA at launchpad where the latest releases are made available as packages. Thus to get the latest stable version do as follows:

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

After that you will have Git 2.x installed and the 1.7.x version removed.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.