7

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?
Patoshi パトシ
  • 2,993
  • 15
  • 32
  • 44

2 Answers2

16

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.

Luís de Sousa
  • 13,227
  • 26
  • 81
  • 128
7

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
Jens Erat
  • 5,051
  • 7
  • 31
  • 37
tdm00
  • 86