Hello, friends. In this post for newbies, you will learn how to install GIT on Ubuntu 22.04 Simple? Yes, but for those who just want to give Linux a try, it could be quite useful.
Introduction
Git is an open source, cross-platform distributed version control system (DVCS) that was initially developed by Linus Torvalds in 2005. Believe it or not, there are a staggering number of software projects that rely on Git for version control, including commercial and open-source projects.
This makes Git a must for every developer and professional involved in the software lifecycle.
So, it’s not too complex to install Git on Ubuntu 22.04, and today we’re going to demonstrate it for you
Install Git on Ubuntu 22.04
There are 3 methods to install Git on our system. So, the choice is up to you.
Method 1: Git through the official repositories of Ubuntu 22.04
As Git is so important nowadays, it is present in the official Ubuntu repositories. Therefore, open a terminal and update the system
sudo apt update
sudo apt upgrade
Then simply run this command
sudo apt install git
Finally, check the version we have installed
git --version
git version 2.34.1
This will complete the process. Personally, I would recommend this method for any user and especially for newbies.
Method 2: Installing Git using a PPA
The version included in the official Ubuntu repositories will eventually get old. And even though they are safe versions, sometimes it is convenient to have recent versions.
The best way is to add the git PPA and install from there. To complete this, open a terminal and after updating the whole system, add the PPA.
sudo add-apt-repository ppa:git-core/ppa
sudo apt update
Next, install Git
sudo apt install git
And finally check the installed version
git --version
git version 2.37.2
The best thing about this method is that not only will we get a recent version, but we can update Git along with the system.
This is usually the recommended method for most users.
Method 3: Install Git by compiling your code
The third method is something more thought for advanced users because it takes more time and process.
So, in a terminal install all the dependencies
sudo apt install build-essential make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext
Then download with wget the source code of the latest stable version from Git which at the time of writing this post is 2.37.2
just find out which is the latest version and modify the command
cd /tmp/
wget -c https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.37.2.tar.gz
Then, unzip the file
tar xvzf git-2.37.2.tar.gz
Access the generated folder
cd git-2.37.2
And start the configuration:
sudo make prefix=/usr/local all
sudo make prefix=/usr/local install
At the end, you will have Git available.
git --version
So, we are ready.
Conclusion
Thanks to this post, you learned how to install Git on Ubuntu 22.04. It’s a post dedicated to newbies, but it’s good for everyone.