Feb 04, 2025
Elvinas S.
3min Read
Modern software development requires a lot of work to be successful. One of the most important steps is choosing a distributed version control system.
Such systems help you keep track of every code change and revert previous stages if needed. One of the most popular version control systems is Git.
In this tutorial, we’ll show two simple ways how to install Git on Ubuntu and how to configure it.
Download complete GIT cheat sheet
Git installation on an Ubuntu system requires three essential objects:
There are two ways to install Git on Ubuntu. We’ll break them down one by one, but you can choose which one works best for you. It’s worth noting that both require access to the terminal.
Installing Git With APT
Ubuntu already has Git in the default repository. It can be easily installed with the help of the APT package management tool:
sudo apt-get update
sudo apt install git
Keep in mind that the Git version in the APT package manager might differ from the recent version found on the GitHub source website. You can check the available versions using this command:
apt-cache policy git
Here’s an example of what the output would look like:
There are two available versions – 2.17.1 and 2.17.0. The candidate version shows which version will be installed.
Alternatively, use this command after installing Git to check the version:
git --version

Installing Git from GitHub
We recommend proceeding with the GitHub installation method if you want to install a different version of Git:
sudo apt-get update
sudo apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev build-essential
wget https://www.kernel.org/pub/software/scm/git/git-2.36.1.tar.gz
tar -zxf git-2.36.1.tar.gz
cd git-2.36.1
make prefix=/usr install install-doc install-html install-info
git –-version
If a Git version number appears, that means the installation was successful.
The previous method will install Git globally. If a local installation is needed, refer to the INSTALL file located in the archive for instructions.
Once Git is installed, you will need to configure it with the Git config command.
git config --global user.name "user_name"
Replace the “user_name” argument with an actual username, quotation marks included.
git config --global user.email "email@myawesomedomain.tld"
Make sure to replace “email@myawesomedomain.tld” with an actual email address, quotation marks included.
git config --list
Git is one of the world’s most popular distributed version control systems. This free tool offers many valuable features and allows developers to perform any code changes with the ability to revert the changes if needed.
This tutorial covered how to install Git on Ubuntu via APT or GitHub. You also learned how to configure Git using your username and email address.
If you have any further insights or questions, leave them in the comments section below.

The easiest way to check if Git is installed is to run the git –version command, which will display the current version of Git.
Another option is to run Git commands like git build. If an error message such as “git: command not found” appears, it means that Git is not installed on the system.
Users can install Git either globally or locally. Git will be installed under the /usr/bin/git directory if you’re going with the global method. This can always be double-checked using the whereis git command, showing the exact Git installation directory.
However, if users use the local installation method, Git will only work on that particular directory. For example, if a user installs Git on the /home/username directory, they will need to navigate to this directory to use Git.
All of the tutorial content on this website is subject to Hostinger's rigorous editorial standards and values.