How to Install Git on Debian 10 Linux

By 

Published on

2 min read

Install Git on Debian

Git is the world’s most popular distributed version control system used by many open-source and commercial projects.

With Git you can collaborate on projects with your fellow developers, keep track of your code changes, revert to previous stages, create branches and more. It is originally developed by Linus Torvalds , the creator of the Linux kernel.

This tutorial explains how to install and configure Git on Debian 10, Buster.

Installing Git

The Git package is included in the Debian’s default repositories and can be installed using the apt package manager. Another installation option is to compile Git from the source which will allow you to install the latest Git version and to customize the build options.

In this tutorial, we will install git using the apt package manager. The installation is pretty straightforward, just run the following commands as a user with sudo privileges :

Terminal
sudo apt update
sudo apt install git

Verify the installation by printing the Git version:

Terminal
git --version

At the time of writing this article, the current version of Git available in the Debian Buster repositories is 2.20.1:

Terminal
git version 2.20.1

That’s it, you have successfully installed Git on your Debian machine.

Configuring Git

Now that you have Git installed it is recommended to set your Git commit email and username. To do that run the following commands:

Terminal
git config --global user.name "Your Name"
git config --global user.email "youremail@yourdomain.com"

You can verify the changes with the following command:

Terminal
git config --list
output
user.name=Your Name
user.email=youremail@yourdomain.com

The configuration settings are stored in the ~/.gitconfig file:

~/.gitconfigconf
[user]
    name = Your Name
    email = youremail@yourdomain.com

To make other changes to your Git configuration you can either use the git config command or edit the ~/.gitconfig file with your text editor . For more options, see our guide on configuring Git username and email .

Updating Git

When a new version of Git is added to standard Debian repositories you can update the Git package through your desktop standard Software Update tool or by running the following commands in your terminal:

Terminal
sudo apt update
sudo apt upgrade

Conclusion

Installing Git on Debian Buster a matter of running a single command. To learn about how to use Git check the Pro Git book .

If you hit a problem or have feedback, leave a comment below.

Linuxize Weekly Newsletter

A quick weekly roundup of new tutorials, news, and tips.

About the authors

Dejan Panovski

Dejan Panovski

Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 800+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.

View author page