Tuesday, September 22, 2020

How to Install Git on Debian 10 Linux Operating System

Must read

How to Change Hostname on Ubuntu 20.04 Linux

The hostname is known as the system's identifier, which is set at the time when we are installing the Ubuntu operating system.

How to Install Node.js and NPM on Debian 10 Linux

The Node.js is the very well-known JavaScript runtime environment used to JavaScript code server-side execution. It is an Open-source, cross-platform supported environment....

How to Install Go on Debian 10 Linux

Go is a very new and most popular open-source programming language; Google creates it. There are many popular software/applications developed using the...

How to Deploy Rocket.Chat on Debian 10 Linux

Rocket.Chat is a very popular open-source team communication system; it is famous as an alternative to Slack. It provides various features along...
SATISH KUMAR
I am Satish Kumar, Founder of LinuxConcept. Linux and F.O.S.S enthusiast, love to work on open source platform and technologies.

Today in this tutorial will get to know how to install and configure Git on Debian 10 Linux.

Nowadays, Git is the most famous version control system, as it supports distributed architecture and functionalities, we called it distributed version control system. It used by much more open source and commercial projects.

It has the functionalities to track the code changes, create branches, revert the project to previous stages, and collaborate with team members and your fellow developers.

Linus Torvalds was the first person who initiated the Git project and developed it; He is the person who creates the Linux Kernel also.

I have done all stuff on Debian 10 what written in this article but hope it will also work on any Debian System.

Prerequisites

Before continue with below process to install Git, make sure your operating system is Debian 10, and you have logged in as a user who is having sudo privileges.

Install Git with APT package Manager

The recommended and easiest way to install Git into the Debian system is by using the native package manager (APT) from the default repository of Debian Operating System.

This process will install the Git with the version available in the Debian repository but if you want to install any other version or latest version of Git, follow the process of Installing Git from Source tutorial.

You can install Git into Debian System using APT package by following steps:

Step 1- Update Debian repository’s package index

Always update the repository package index before installing the new package in the system.
$ sudo apt-get update
or
$ sudo apt update
Step 2- Installing Git
 
Once the repository package list is get updated you can start Git installation by using the following command:
$ sudo apt-get install git
Or 
$ sudo apt install git
Step 3- Verify and check the installed version of Git
 
You can verify the new application installation by checking the version by running the command; here we are checking Git installed version using the following command:
$ git –version
Output:

git version 2.11.0

Now, Git version 2.11.0 successfully installed in your system; Now you can move into the Git configuration tutorial to complete your setup.

Install Git from Source

You can use Source installation for Git as another option of installation for Debian Operating system. By using this installation, you can use the latest version or any version you like.

The only drawback of source installation is not being able to maintain using the APT package manager.

In the Linux operating system, when you use a package manager to install any application, it will install all required dependencies automatically, but when you use source installation, you need to install all dependencies manually.

So, first, update the package list and install all dependencies for Git on Debian system using the following command.

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

After installation of all dependencies go to the Git project on GitHub and copy the package link that ends with .tar.gz:

I have got the latest version 2.22.0 at the time of writing this article as you can see in the above picture.

Now download the Git source file in the /usr/src directory. Generally, we kept all source files at this location, to do this first need to change the directory with the following command:

$ cd /usr/src/

Now you can use the wget command to download the Git source file with name git.tar.gz, as shown below:

$ sudo wget https://github.com/git/git/archive/v2.22.0.tar.gz -O git.tar.gz

Once the file gets downloaded, the file needs to extract and get into the new directory.

$ sudo tar –xzf git.tar.gz
$ cd git-*

Now, before installation needs to compile the source files by using the following command:

$ sudo make prefix=/usr/local all

After completion of a successful compilation, you can install git using this command:

$ sudo make prefix=/usr/local install

When you get the prompt after successful completion of Git installation, you should add folder location into PATH variable and verify it by checking the version of installed Git, as shown below:

$ sudo export PATH=$PATH:/usr/src/git-2.22.0
$ git --version
Output:

git version 2.22.0

There is the only problem with source installation is when you want to upgrade on latest version again you need to repeat the installation process.

Git Configuration

After installation of Git version control system needs to set up the email and username for Git commit, you can do it by using the following command:

$ git config - -global user.name “Your UserName”
$ git config - -global user.email “Your email ID”

When the above operation for setting the email ID and username completed, you can verify by using the following command:

$ git config --list
Output:

user.name=satish
[email protected]

The configuration saved into the ~/.gitconfig file:

[user]
	name = satish
	email = [email protected]

If you want to make a change in this configuration, you can use the git config command or edit the ~/.gitconfig file manually.

Conclusion

Now you have learned Git Version control system installation on Debian 10 Operating system; you can also check highly recommended book on git – Pro Git to learn more about Git.

If you get any problem while installing Git into your system or have any feedback, feel free to leave a comment below.

- Advertisement -

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to Change Hostname on Ubuntu 20.04 Linux

The hostname is known as the system's identifier, which is set at the time when we are installing the Ubuntu operating system.

How to Install Node.js and NPM on Debian 10 Linux

The Node.js is the very well-known JavaScript runtime environment used to JavaScript code server-side execution. It is an Open-source, cross-platform supported environment....

How to Install Go on Debian 10 Linux

Go is a very new and most popular open-source programming language; Google creates it. There are many popular software/applications developed using the...

How to Deploy Rocket.Chat on Debian 10 Linux

Rocket.Chat is a very popular open-source team communication system; it is famous as an alternative to Slack. It provides various features along...

How to Install Tomcat 9 on Ubuntu 20.04 Operating System

The Apache Tomcat software is an open source implementation of the Java Servlet, JavaServer Pages, Java Expression Language and Java WebSocket technologies. Apache...