How to Install Git on Debian 8/9/10

Git is one of the most popular version control systems currently available. Many projects’ files are maintained in a Git repository, and sites like GitHub, GitLab, and Bitbucket.

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.

This tutorial explains how to install and configure Git on Debian 8/9/10.

Step 1. Installing Git With Default Packages

The Git package is included in the Debian’s default repositories and can be installed using the apt package manager.

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

01.update your local package index.

sudo apt update

02.download and install git with apt install command.

sudo apt install git

03.verify the installation

git --version

The output look something like below:

git version2.11.0

Step 2. Configuring Git

Now that you have Git installed, you should configure it so that the generated commit messages will contain your correct information.because Git embeds this information into each commit we do. To do that run the following commands:

01.Configure your name and email

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

02.Verify the changes

git config --list

Output:

user.name=Your Name
user.email=youremail@yourdomain.com

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

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

To make other changes to your Git configuration you can either use the git configcommand or edit the ~/.gitconfig file with your vi editor.

There are many other options that you can set, but these are the two essential ones needed. If you skip this step, you’ll likely see warnings when you commit to Git.

Step 3. 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 update
sudo apt upgrade

Conclusion

You should now have Git installed and ready to use on your Debian Linux system. To learn about how to use Git check the Pro Git book.

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

Leave a Reply

Your email address will not be published. Required fields are marked *