Learn how to easily install the latest version of Git in Ubuntu 20.04.

How to install the latest version of Git in Ubuntu 20.04

Although not a lot of developers notice it, most of the time when you install Git through APT, the version of Git registered in the default repositories isn't up to date with the latest official version. In Ubuntu you can usually install Git using the following command:

sudo apt install git

Once the installation finishes, you can print the version of Git with git --version, which outputs in my case the following text:

git version 2.34.1

My Ubuntu 20.04 has been recently installed and their repositories are up to date, however the latest version of Git till the date of writing this article is the version 2.37.2. In this short article, I will explain to you how to easily install the latest release of Git for Ubuntu 20.04.

1. Register latest Git PPA

Of course the most obvious thing would be to compile Git from source, however we don't that so often in Ubuntu, at least when someone offers an easier solution. There's an official Git personal package archive (PPA) maintained by the “Ubuntu Git Maintainers” team. Register the PPA using the following command:

sudo add-apt-repository ppa:git-core/ppa

This command will prompt for confirmation, you only need to press Enter. Then update the repositories using:

sudo apt update

2. Install latest Git version

As last step, independently of your current installation, you may simply install or upgrade the git package using the following command:

sudo apt install git

Once you confirm the installation and the installation finishes, you should be able to print the new version of Git using the following command:

git --version

Which as mentioned at the beginning of the article, till the date, the latest version is:

git version 2.37.2

Happy coding ❤️!


Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Sponsors