Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've just set up a new machine with Ubuntu Oneiric 11.10 and then run

apt-get update
apt-get upgrade
apt-get install git

Now if I run git --version it tells me I have git version but on my local machine I have the much newer git version

I know I can install from source to get the newest version, but I thought that it was a good idea to use the package manager as much as possible to keep everything standardized.

So is it possible to use apt-get to get a newer version of git, and what is the right way to do it?

share|improve this question
up vote 33 down vote accepted

You have several options:

  1. Either wait until the version you need is present in the repository you use.
  2. Compile your own version and create a deb.
  3. Find a repository that provides the version you need for your version of your distribution(e.g. Git PPA).
  4. If you don't need any particular feature from the newer version, stay with the old one.

If a newer version is available in the repositories you use, then apt-get update && apt-get upgrade (as root) updates to the latest available version.

share|improve this answer
+1 for the PPA. Otherwise compile from source and use checkinstall to cleanly install a .deb – Axel Knauf Mar 7 '12 at 15:54
Just what I needed. Thank you. – sshakir May 2 '13 at 5:35

Here are the commands you need to run, if you just want to get it done:

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

As of Dec 2014, I get git 2.2.0 that way, while the version in the Ubuntu Trusty repositories is 1.9.1.

Note that add-apt-repository is installed via:

sudo apt-get install python-software-properties software-properties-common
share|improve this answer
This works, and you posted it in just in time for me. :) – tchakravarty Dec 1 '14 at 13:59
This looks like the answer I want, but when I run through those steps, I still get my old git install version (1.8.x) on Ubuntu 14.04. – Steve Midgley Dec 17 '14 at 1:35
worked for me... – JayKandari Jan 9 '15 at 7:38
After having added the PPA, I get 404 Not Found when trying to do apt-get update.. – digory doo Jul 23 '15 at 7:43
I have done these steps and got no error, but still my git was not updated, and I still have old version Is it becuase I'm using ubuntu 10.04 ? – ransh Aug 14 '15 at 15:42

Doing a search for "git ppa" gives Git stable releases. See instructions for installing here. You can also install the package by downloading directly from the web page, and installing with dpkg -i.

share|improve this answer

If you just want to update to latest version using terminal paste following code into it and hit enter

git clone https://github.com/git/git

share|improve this answer
Downvoters: it will help to explain what is wrong with this. – GreenAsJade Jun 6 at 6:04
it would help to explain how this "git clone" helps, and what it does :) – woohoo Jul 9 at 15:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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