Install GIT on Debian 10

0
50

Software development is one of the activities that can best be done on a Linux system. In the first place, because it is stable and because the main tools for development are available with few commands. We are talking about both professional and community-level tools. They are all installable on Linux. One of these tools is GIT which is used to control the versions of an application. So, in this post, you will learn how to install Git on Debian 10. We will even give you two options to realize the goal.

So, Git?

If you are starting to develop applications you may not know that Git is a free, open-source version control system and that it is perhaps the best. Many developers rely on it to control the versions of their applications. By versions, we mean those in development.

Using Git you can control and separate development in each of those development branches. So the changes of one do not affect the others.

Read Introduction to the Git branches.

In this way, it is good practice to develop applications using a version control system as support.

Install Git on Debian 10

Debian 10 is one of the few distributions that have such complete package repositories. So, presumably, there is some Git in the official repositories.

However, it is also a good idea, to know how to install Git differently in case we need it. This way is compiling the source code of Git and get the latest stable version. In this tutorial, I will teach you how to do it both ways.

1) Using the official repository

Debian 10 comes with Git 2.20 in the official repositories. That is, it is a good version, but with the passage of time, it will become obsolete.

Using this option, the installation is quite easy, and just open a terminal session and run the following command:

:~$ sudo apt install git

Or, if you do not have sudo, please read How to enable sudo on Debian 10?

Then, you can check the installed version.

:~$ git --version
git version 2.20.1

Now, you can use it.

2) Building the Git source code

Compiling the Git source code is the best way to get the latest version. All this in a safe way because it will not be compiled by third parties.

The process is simple but requires a few extra steps. So let us get started.

First, install the necessary programs to make the compilation:

:~$ sudo apt install build-essential make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip
1.- Install required package for the build from source code
1.- Install required a package for the build from source code

Now, we can download the source code.

:~$ cd /tmp/
:~$ wget https://github.com/git/git/archive/v2.22.0.zip -O git.zip
2.- Download Git code
2.- Download Git code

Next, decompress it and access to the folder.

:~$ unzip git.zip
:~$ cd git-2.22.0

Now, you can start the compilation by running the following commands:

:~$ sudo make prefix=/usr/local all
:~$ sudo make prefix=/usr/local install
3.- Install Git on Debian 10
3.- Install Git on Debian 10

Next, check the installed version.

:~$ git --version
4.- Git installed
4.- Git installed

And that is it. You can start to use Git.

Conclusion

Git is one of those applications that every developer must be able to manage to improve their workflow. Therefore, it is important to install it in Debian 10 and two ways have been shown to achieve this. One of them is using the package available in the official repositories and the other is compiling the source code.

Please share this post and join our Telegram channel.

LEAVE A REPLY

Please enter your comment!
Please enter your name here