Sep 30, 2023 4 min read

How to Install Git on Debian 12

Install Git on Debian 12 with our step-by-step tutorial. Git is an efficient open-source version control system for projects of all sizes.

Install Git on Debian 12
Table of Contents

Choose a different version or distribution


Before we go into how to install Git on Debian 12, it's important to first understand - what is Git?

Git is a popular open-source distributed version control system that can handle a wide range of projects, from small to large, quickly and efficiently. It stands out since it is user-friendly and simple to understand.

Installing Git can be done in two ways. You can use the APT package manager to install from Debian repositories, or you can install directly from the source, which will give you the most recent version of Git.

In this tutorial, you will install Git on Debian 12. We will also address a few FAQs on how to Install Git on Debian 12

Advantages of Git

  1. Distributed Version Control: Git allows multiple users to work on a project simultaneously, making collaboration seamless and efficient.
  2. Lightweight and Speedy: Git's design ensures quick operations, making it highly responsive and ideal for both small and large projects.
  3. Branching and Merging: Git simplifies branching, enabling developers to experiment with different features and merge changes effortlessly.
  4. Offline Support: With Git, you can work offline and commit changes locally before synchronizing with the remote repository.
  5. Rich Ecosystem: Git benefits from a vibrant community and extensive tooling, empowering developers with a wide range of resources and integrations.

Method 1: Install Git Using APT Package Manager

To begin, make sure Debian's package index is up-to-date.

sudo apt update

Once the update is complete, use the simple command supplied to install Git from Debian's APT repository.

sudo apt install git

Check the version of Git after it's been installed:

git --version

Method 2: Installing Git from Source

Installing Git from the source is a better and more flexible solution. While this is a lengthier process, it will ensure that you have the most recent version of Git.

Install all of the Git dependencies first:

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

After you've finished installing Git, go to the project's Github page.

Navigate to the 'Master' branch, click the 'Tags' link, and select the most recent Git option, which is usually the top choice. Selecting the release candidate version is not recommended (which bears the suffix rc). This is a Beta version, so expect it to be buggy and unstable.

Git version 2.34.1 is the most recent version at the time of authoring this tutorial. This is the version that we'll be installing.

Select the latest Git version

Click the 'Code' button on the far right, then copy the 'Download ZIP' option link.

Clone git repository on Github

Or Return to your Debian 12 server and use the wget command to get the zip file.

wget -O

After that, unzip the compressed file.


Then go to the directory that isn't compressed and start compiling.

cd git-master
sudo make prefix=/usr/local all

Then install

sudo make prefix=/usr/local install

Verify that you have the most recent version of Git when the installation is complete.

git --version

How to Set Up Git

We've successfully installed Git on Debian 12 Server at this stage. There's just one last thing to do. We'll need to configure it so that commit messages contain the relevant information.

We'll give our name and email address, which will be included in the commit messages. To do so, use the git config commands listed below.

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

Run the following command to verify that the configuration has been set up:

git config --list

The /.gitconfig file contains these details. You can also double-check by looking at the file.

cat ~/.gitconfig

FAQs to Install Git on Debian 12

How can I verify if Git is successfully installed on Debian 12? 

To verify the installation, you can run git --version in the terminal, which will display the installed Git version if it was installed correctly.

What dependencies are required to install Git on Debian 12? 

Git has minimal dependencies, but installing build-essential package might be necessary. Use sudo apt install build-essential to install it.

How can I check if Git is already installed on my Debian 12 system? 

You can verify if Git is installed by running the command git --version in the terminal. If Git is installed, it will display the version information.

Can I upgrade Git to a newer version of Debian 12?

Yes, you can upgrade Git on Debian 12 using the package manager. Execute sudo apt upgrade git to upgrade Git to the latest available version.

Does Git installation on Debian 12 require administrative privileges? 

Yes, you need administrative privileges to install Git on Debian 12. Use the sudo command before running the installation command.

How can I configure Git after installing it on Debian 12? 

Git's configuration is done through the git config command. You can set your name, email, and other settings by running git config --global.

Does Git support integration with other tools on Debian 12? 

Yes, Git provides seamless integration with various tools such as text editors (Atom, Sublime Text), IDEs (Visual Studio Code, IntelliJ IDEA), and Continuous Integration platforms (Jenkins, Travis CI).


You may now use Git to host your work on GitHub or any other code hosting and collaboration platform. We led you through the installation of Git on a Debian 12 server in this tutorial.

Leave a comment below if you run into any issues or have any feedback.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Blog - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.