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 11 / 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 11 / 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 on Debian 11 / 10
Debian 11 / 10 include Git in the official repositories. 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 11/10?
Then, you can check the installed version.
:~$ git --version git version 2.30.2
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
Now, we can download the source code.
:~$ cd /tmp/ :~$ wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.33.0.tar.gz
Next, decompress it and access to the folder.
:~$ tar xvfz git-2.33.0.tar.gz :~$ cd git-2.33.0
Now, you can start the compilation by running the following commands:
:~$ sudo make prefix=/usr/local all :~$ sudo make prefix=/usr/local install
Next, check the installed version.
:~$ git --version
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.