How To Install Git on Debian 9

Install Git on Debian ,This educational will show you a way to install and configure Git on Debian 9.

Git is the world’s most famous allotted model manage device utilized by many open supply and commercial initiatives. It allows you to hold song of your code adjustments, revert to previous tiers, create branches and to collaborate together with your fellow builders.

Git is initially evolved with the aid of Linus Torvalds, the creator of the Linux kernel.

This academic was tested on Debian 9 but it have to additionally work with any previous Debian version.

Install Git on Debian ,Prerequisites

Before continuing with this educational, make certain you’re logged in as a user with sudo privileges.

Installing Git with Apt

The easiest and the recommended way to put in Git is by way of using the apt bundle management device from the Debian’s default repositories. If you want to install the contemporary solid version of Git pass directly to the Installing Git from a Source segment of this educational.

The following steps will display you how to installation Git on your Debian gadget:

01.Update package index.

Before installing new packages you should always update the apt package index:

sudo apt update

02. Install Git.

Once the list is up to date issue the subsequent command to put in Git:

sudo apt install git

03. Verify Git installation.

To verify the installation kind the subsequent command to print the Git version:

git --version
git version 2.11.0

As you can see from the output above, you have efficiently mounted Git model 2.11.0. You can now circulate directly to the Configuring Git section of this academic to complete your setup.

Install Git on Debian ,Installing Git from a Source

Another installation alternative is to bring together Git from the source which will assist you to installation the modern Git model and to personalize the construct alternatives, however you may no longer be able to keep your Git set up via the apt package manager.

Before continuing with the following steps, first you want to install the packages essential to construct Git to your Debian gadget:

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

Once the dependencies are installed open your browser, go to Git mission’s replicate on GitHub and duplicate the modern release hyperlink cope with that results in .Tar.Gz:

At the time of writing this article, the latest stable Git version is 2.18.0.

We are going to download Git source within the /usr/src directory that is the not unusual region to area source files, change to the listing with:

cd /usr/src/

Use the wget command to down load the archive report as git.Tar.Gz:

sudo wget -O git.tar.gz

Once the down load is complete, extract the report that you downloaded and switch to the git supply directory by typing:

sudo tar -xf git.tar.gz
cd git-*

Now, you can compile and install Git by typing these two commands:

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

Once the installation is completed verify it by typing the following command which will print the installed Git version:

git --version
git version 2.18.0

Later, if you need to improve to a more recent version, you may need to copy the set up method.

Configuring Git

Now that you have Git installed it is recommended to set your Git commit email and username:

git config --global "Your Name"
git config --global "[email protected]"

You can verify the changes with the following command:

git config --list
output Name
[email protected]

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

" ~/.gitconfig "

    name = Your Name
    email = [email protected]

If you need to make other adjustments for your Git configuration you could both use the git config command or edit the ~/.gitconfig report by hand.


You have discovered the way to set up Git to your Debian system. You ought to now check the Pro Git ebook and learn more about a way to use Git.