How to install the latest version of Git in Debian 9?

0
34
Git
Git

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
1.- Upgrade the system
1.- Upgrade the system

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
2.- Install some required packages
2.- Install some required packages

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
3.- Download the Git source code
3.- Download the Git source code

 

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
4.- Install the latest version of git
4.- Install the latest version of git

Once the process is complete, you can verify which version is installed.

:~# git --version
5.- Git version
5.- Git version

With this, Git is now installed and ready to use.

Conclusion

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.

LEAVE A REPLY

Please enter your comment!
Please enter your name here