How to Install Git on Debian 10 Linux

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 :

sudo apt updatesudo apt install git

Verify the installation by printing the Git version:

git --version

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

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:

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

You can verify the changes with the following command:

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

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

~/.gitconfig
[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 .

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:

sudo apt updatesudo 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.