Ubuntu – How to install the latest version of Git with apt

aptgitsoftware installation

I read about a security flaw in Git, which was fixed in version 2.2.1. I currently have Git 2.1.0 on my system (Ubuntu 14.10), and tried to reinstall it with apt. However, apt told me that I currently have the latest version.

The Git website does not have prebuilt versions for Linux. They say that you can install it with package managers. Without building from source, how would I install the latest version of Git?

Best Answer

Use the PPA from the maintainers of git on Ubuntu:

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

If you don't know what PPAs are, first read What are PPAs and how do I use them?

If you receive an error about add-apt-repository command not found you need to install software-properties-common, and then redo the above steps.

sudo apt-get install software-properties-common