How to Install Git Version Control System on Debian 11

Git is a distributed version control system that was originally developed by Linus Torvalds in 2005. It has since been made available as an open-source project, allowing for more people to contribute and use it across all platforms of development without charge. It has since grown to be the most widely used distributed version control system (DVCS) in the world. Git became so popular because of its speed, reliability, security, and ease of use. These qualities have allowed it to become a fundamental part of GitHub – one of the largest code repositories in the world – which has over 20 million users on its website alone.

Despite being such an essential tool for many people around the globe, there are still some who don’t know how to install Git on Debian 11 operating systems. This tutorial will show you how to do just that.


There are some prerequisites that must be fulfilled before continuing on with this tutorial. First, you must have root access to your system. If you do not have this already, make sure to run the “sudo su” command in order to become root.

It is also important that you have a common sense understanding of Linux terminal commands. With these prerequisites out of the way, it’s finally time to move on to actually installing Git.

Updating the System

You need to update all of your current packages with the apt-get command.

sudo apt-get update

This will make sure that all installed packages are up to date with the latest patches and security enhancements. If this command returns any errors, try re-running it. Once you have successfully run this command, move on to install required dependencies.

While you’re updating the system, you may also want to run this command in order to install all of Git’s required dependencies. Such as libghc-zlib-dev, libexpat1-dev.

sudo apt install make libghc-zlib-dev libexpat1-dev -y
sudo apt install libssl-dev libcurl4-gnutls-dev gettext unzip -y

Installing Git Using the APT

Git may be installed quickly using Debian’s repositories, which are available by default. It is important to note that the version you install from the repositories may be older than the most recent version that is accessible. If you need the most recent version, you should go to the next part of this guide, where you will learn how to install and build Git from source.

Run the following command to install Git on Debian 11.

sudo apt-get install git

This command will pull down the installer from the Debian repositories and place it in your current directory. It will also install all of the required dependencies that are needed to run Git.

It’s important to note that while running the installer, you may be prompted for a few configuration options. The defaults should work just fine for most people, though, so feel free to accept these by type Y and hit Enter.

Install Git

If you have successfully completed these steps, you now have Git installed on your Debian machine. By running the “git –version” command, you can check to make sure that it is properly installed on your system.

git --version

You should get an output like the one below.

Check Git version

As the screen is shown, we successfully installed the Git v2.30.2 on Debian 11.

Installing Git from Source

It is possible to install Git using a more flexible approach by compiling the program from source code. Even though this will take longer and will not be maintained by your package management, it will enable you to get the most recent version and will offer you a degree of control over the settings that you add if you want to customize.

First, open your web browser, navigate to the official Git website at:

Navigate to the Master branch, click on Tags, and then click on the latest release version, which usually will be at the top. As of this writing, it is v2.33.0. This is the release that we are going to install.

You might want to avoid running release candidate (rc) versions of Git, since it is possible that they have not been thoroughly tested and may be unstable.

Get latest Git version

Now, on the top-right of the page, click on the Code button, right-click on the Download ZIP button, and copy the link address.

Choose Git version and download the source code

Now, return to your Terminal and execute the following command to download the zip file to the temporary directory.

cd /tmp
wget -O

This command will display a download bar in your Terminal. Wait until the download has finished, and then execute the unzip command to extract the file.


This command will extract the zip file. Feel free to remove the zip file from your temporary directory to conserve disk space.


At this point, we have the Git source code in the current directory. Run the following command to install Git.

cd git-*
sudo make prefix=/usr/local all
sudo make prefix=/usr/local install

This command will compile the source code and install it to your system. It will also install the compiled binaries, man pages, and other additional information. It takes some time to complete the entire process since it must compile a large number of packages which can be time-consuming. Please be patient.

When it finishes, you can verify that the installation was successful by executing your first Git command, which is the git –version command. You should receive this output if everything went as planned.

git --version

Check Git version

As you can see in the screenshot, we have installed the latest version of Git, which as of this writing, is v2.33.0. Different from the v2.30.2 that we installed using the package manager, this version is a lot more recent.

First-Time Git Setup

Now that you have Git installed, it’s time to configure some useful settings. Entering your name, and email address into each commit you make is essential if we want to track who made which changes. Git embeds this information into the commit itself so that it is preserved for all time. Git also embeds this information with each commit you do.

To provide our name and email address, which will be incorporated in the commit messages, use the git config command shown below.

git config --global "vitux"
git config --global "[email protected]"

To show all of the configuration settings and verify that they have been correctly set, we can use the following command:

git config --list

Now that each time you create a commit using git commit, your name, and email address will be included in the message area of the commit. You can also include other useful information for each commit, such as a release number or the bug number being fixed.

There are many more settings that may be configured, but these are the two that are absolutely necessary. If you don’t complete this step, you’ll most likely receive warnings when you submit your changes to Git.


In this guide, you have learned how to install Git on your Debian 11 system so you can start tracking the changes in your software. It is very important that each developer has their own local copy of the source code repository so they can work on it without disturbing others or disrupting their development process.