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, the software stability is of upmost importance this is why Ubuntu 18.04 and other distributions often provide older but stable version of a software that is 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:
[email protected]:~$ 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.
[email protected]:~$ 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.
Trivia
Did you know that Git version control system was created by none other than Linux creator Linus Torvalds?
Configure Git [Recommended for developers]
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:
[email protected]:~/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 '[email protected](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.
In the end…
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 :)
My Mom was a huge fan of Agatha Christie as well. I’m sure that it’s much easier these days, but back when I was a kid (born 1970), I remember her collection of every single one of her books. To put it in perspective, she had to actually go to Australia to complete her collection!
Anyway, my name is Michael and I’m writing to ask for your help. I have Git 2.8.0 installed, and I am trying to install 2.9.5 which have a .gz and an .xz installed to /Downloads folder, but can not figure out how to install either one of the compressed files. I have tried make, configure, and every combination of the two, and I keep getting the strangest error messages.
Currently Running Kubuntu 20.10 Groovy Gorilla.
Hello Michael,
You downloaded the compressed file, you should extract them and see what it contains.
Anyway, unless you really need the newest version, I wouldn’t recommend installing Git (or any other software) from the source code. Manually handling the software like this will be a pain and you’ll have to do it again for a new version. This is why Linux has package management so that one can easily install and update the software.
P.S. Your mother really travelled to Australia for Christie? Wow!