How to Install Latest Git Version on Ubuntu

Installing Git on Ubuntu is very simple. Getting the latest Git version is not that difficult either. Learn how you can install the latest Git on Ubuntu.
Warp Terminal

Installing Git on Ubuntu is very easy. It is available in the main repository of Ubuntu and you can install it using the apt command like this:

sudo apt install git

Easy? Isn’t it?

There is only a slight little problem (which might not be a problem at all) and that is the version of Git it installs.

On an LTS system, software stability is of utmost importance this is why Ubuntu 18.04 and other distributions often provide older but stable versions of software that are well-tested with the distribution release.

This is why when you check the Git version, you’ll see that it installs a version which is older than the current Git version available on Git project’s website:

abhishek@itsfoss:~$ git --version
git version 2.17.1

At the time of writing this tutorial, the version available on its website is 2.25. So how do you install the latest Git on Ubuntu then?

Install latest Git on Ubuntu-based Linux distributions

One way would be to install from source code. That cool, old school method is not everyone’s cup of tea. Thankfully, there is a PPA available from Ubuntu Git Maintainers team that you can use to easily install the latest stable Git version.

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

Even if you had installed Git using apt previously, it will get updated to the latest stable version.

abhishek@itsfoss:~$ git --version
git version 2.25.0

The beauty of using PPA is that if there is a new stable version of Git released, you’ll get it with the system updates. Just update Ubuntu to get the latest Git stable version.

📜
Did you know that the Git version control system was created by none other than Linux creator Linus Torvalds?

If you have installed Git for development purposes, you’ll soon start cloning repos, make your changes and commit your change.

If you try to commit your code, you may see a ‘Please tell me who you are’ error like this:

abhishek@itsfoss:~/compress-pdf$ git commit -m "update readme"

*** Please tell me who you are.

Run

  git config --global user.email "[email protected]"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

fatal: unable to auto-detect email address (got 'abhishek@itsfoss.(none)')

This is because you haven’t configured Git with your personal information which is mandatory.

As the error already hints, you can set up global Git configuration like this:

git config --global user.name "Your Name"
git config --global user.email "[email protected]"

You can check the Git configuration with this command:

git config --list

It should show an output like this:

[email protected]
user.name=abhishek

This configuration is stored in ~/.gitconfig file. You may also change it manually to change the configuration.

Start learning Git

If you are new to Git, here's a quick primer into basic Git commands.

Basic Git Commands You Must Know [Download Cheat Sheet]
This quick guide shows you all the basic Git commands and their usage. You can also download these commands for quick reference.

I hope this quick little tutorial helped you to install Git on Ubuntu. With the PPA, you easily get the latest Git version.

If you have any questions or suggestions, please feel free to ask in the comment section. A quick ‘thank you’ is also welcomed :)

About the author
Abhishek Prakash

Abhishek Prakash

Created It's FOSS 11 years ago to share my Linux adventures. Have a Master's degree in Engineering and years of IT industry experience. Huge fan of Agatha Christie detective mysteries 🕵️‍♂️

Become a Better Linux User

With the FOSS Weekly Newsletter, you learn useful Linux tips, discover applications, explore new distros and stay updated with the latest from Linux world

itsfoss happy penguin

Great! You’ve successfully signed up.

Welcome back! You've successfully signed in.

You've successfully subscribed to It's FOSS.

Success! Check your email for magic link to sign-in.

Success! Your billing info has been updated.

Your billing was not updated.