Debian is a great operating system. Perhaps along with CentOS and RHEL the most stable of all Linux. Debian can do very important jobs like developing applications or being the operating system of a server. All this thanks to the fact that it is a very stable system where the software is constantly tested to obtain the best results. However, the software available in Debian is not always the most up to date and over time this can be a problem. So, with this in mind, I will teach you how to install the latest stable version of Git on Debian 9 Stretch.
Debian is very stable thanks to the way packages are accepted in its repositories. Because they follow a very strict quality control which guarantees that they are very stable but not updated by the testing time that passes. So, some applications improve with the publication of new versions and many times we need it. It is the concrete case of Git that in the current repositories of Debian is version 2.11 but the last stable is version 2.21.0 So let us go for it.
Install the latest version of Git from the source code
There is no reliable repository to install the latest version of Git on Debian 9. However, we can manually compile the source code. The process is not complicated and will help us to have current and fast Git.
First of all, you have to update the system.
:~$ su :~# apt update && apt upgrade
After that, you need to install some packages to install Git.
:~# apt install build-essential make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip
Then, it is necessary to know which is the latest stable version of Git. To do this, it is good to go to the program website. At the time of writing this article, it is 2.21.0 so the command to write is as follows.
:~# cd /tmp/ :~# wget wget https://github.com/git/git/archive/v2.21.0.zip -O latestgit.zip
Next, decompress it and move to the generated folder.
:~# unzip latestgit.zip :~# cd git-2.21.0.zip
Now, you can build and install Git. To do it, just run these commands:
:~# make prefix=/usr/local all :~# make prefix=/usr/local install
Once the process is complete, you can verify which version is installed.
:~# git --version
With this, Git is now installed and ready to use.
Getting the latest version of Git in Debian 9 is not a complicated matter, however, it can be useful for the development of our applications. We have achieved this by manually compiling the application, this way it becomes simpler and safer.
Please share this post with your friends.