How to Install Git on Debian 11


Git is an open-source distributed version control system. It handles everything related to the code from small to very large scope projects efficiently. It enables developers to upload their code to hosting sites like Github, BitBucket, and Gitlab. It facilitates code management activities such as reverting to prior versions, branching, and so on.

Git is easy to understand and simple to learn, with a minimal footprint and lightning-fast speed. It beats SCM systems like Subversion, CVS, Perforce, and ClearCase etc. and offers complex features including low-cost local branching, handy staging areas, and many operations.

We will demonstrate in this tutorial, how to install the Git version control system on Debian 11 bullseye distribution.

Install Git on Debian 11 Bullseye Distribution

By using the two different methods, you can install Git on the Debian 11 system.

  • Installing Git from Debian repositories by using the APT package manager
  • Install Git from the source

Method 1: Installing Git from Debian repositories by using the APT package manager

To start the Git installation, make sure Debian’s package index is up to date.

$ sudo apt update

Once all Debian repositories are updated, install Git on Debian 11 by using the following command:

$ sudo apt install git

Once the Git installation is complete, check the Git version by using this command:

$ git –version

Method 2: Install Git from the source

Installing Git from the source is a better and more flexible alternative. This is a longer installation method as compared to the above method but it will install the latest version of Git on your system.

First, install all Git dependencies on your system.

$ sudo apt update

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

Now, jump onto the Git project on GitHub for Git installation

Click on the ‘Master’ branch and then click on ‘Tags’. Here, you can choose the latest Git version. It is recommended that never choose the release candidate version ‘rc’ for installation that is unstable in the beta version.

Now, click on the ‘Code’ and then copy the link to the ‘Download ZIP’ option.

Open the terminal on Debian 11 system and download the Git ZIP file using the wget command.

$ wget -O

Unzip the compressed Git archive and navigate into this directory.

$ unzip
$ cd git-2.36.1

Now, to install git from the source run these commands:

$ sudo make prefix=/usr/local all
$ sudo make prefix=/usr/local install

Check the git version. At this time, you will notice that the latest Git will be installed on your system.

$ git --version

How to set up Git on Debian 11?

Above we successfully installed Git on the Debian 11 system. Now, we will see how to set up Git on a Linux system so that the commit messages provide the correct information about the author.

Now, you need to enter your name and email address that will be incorporated in the commit messages. So, use the ‘git config’ command to apply these changes:

$ git config --global "kbuzdar"
$ git config --global "[email protected]"

To verify all Git configurations, use this command:

$ git config –list

You can also verify the above configurations by viewing the ‘~/.gitconfig’ file.

$ cat ~/.gitconfig


We demonstrated how to install Git on the Debian 11 system. Now, you can start using Git to host your code on GitHub or any other supported platform. Developers should have their local copy of the source code repository as a recommended practice. This allows them to work on it without interfering with the rest of their project’s progress. Thanks!

Similar Posts