Git 1.7.9.5 Upgrade to current release of GIT 2.x on ubuntu 12.04 [duplicate]

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?

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.


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