Here’s a short memo on how to tell apt-get about a new Git version.
Install or update via apt-get
Check if Git is installed and what version it’s on:
$ git --version
git version 1.7.9.5Ideally you would just go:
$ sudo apt-get install gitThe Git version in apt-get is stuck to 1.7.9.5, that might be okay in most
cases, but if you want the latest 2.3.4 (at the time of writing this), you
need to add the latest Git to apt-get with the following command:
$ sudo add-apt-repository ppa:git-core/ppaThe repo is maintained by these people.
Now apt-get knows about the new Git, then install it:
# First update the apt-get package database
$ sudo apt-get update
# Then install git
$ sudo apt-get install gitCheck version and do a little dance:
$ git --version
git version 2.3.4Troubleshooting
If you get an error like:
sudo: add-apt-repository: command not foundThen you need to install the software-properties-common package:
$ sudo apt-get install software-properties-common python-software-properties