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

13,018

Solution 1

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

Solution 2

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:
13,018
Patoshi パトシ
Author by

Patoshi パトシ

Updated on September 18, 2022

Comments

  • Patoshi パトシ
    Patoshi パトシ over 1 year

    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?
  • Rob Sanders
    Rob Sanders over 7 years
    You also need to run sudo apt-get install software-properties-common for apt-add-repository to work.