Today we will look at how to install and update to the latest version of Git. Ubuntu 20.04 comes shipped with Git in their principal repository; however, with Ubuntu 20.04 being an LTS system, the software packages are designed for being stable and do not typically include new releases with upgraded features that could break stability. Ubuntu will only ship security updates for the current LTS version of Git.
So, the issue sometimes with LTS systems is that software packages fall far behind with non-security bugs occurring. Luckily with Ubuntu, we can add custom PPA’s from developers of such software that are trustworthy and typically are the ones to address security issues in the first place. Hence, in the case of Git, the chances of your system being vulnerable are very slim considering the benefits of updating for new features, improvements to non-security related issues and bugs.
What is Git?
GIT is for developers that need a pretty straightforward version control system. Most software is collaborative efforts and sometimes can have hundreds of people with commits working on software development projects. It’s essential to track these commits, which are customarily done in branches in most projects before merged into the master for release. It is easy to review and track down any incorrect commits and revert, leading to a much easier development if anything goes wrong.
Check Git Version
First, check to see what version of git you are currently running, if any, with the following command.
If you have GIT installed, you do not need to remove it as after we install the PPA, you can update it or install it fresh if you do not have it on your Ubuntu system.
Install Custom PPA: GIT-CORE/PPA
Next, we will add a custom PPA GIT Core maintained by the Ubuntu Git Mainters team for the latest stable version.
sudo add-apt-repository ppa:git-core/ppa
Enter your password, and then you will get a message as per the below picture, just hit enter.
Finalize GIT Install and Update
In the final part, run the following command:
sudo apt update
If you have Git installed, you should see two new packages to upgrade.
Do the following command to upgrade
sudo apt upgrade -y
If you need to install Git as you do not have it installed, do the following command:
sudo apt install
Once done, check the version to see your new Git version.
As you can see, we went from v2.25.1 to v2.31.1. Furthermore, any new updates will be automatically downloaded and installed with the new PPA repository added.
Comments and Conclusion
Git is a fantastic piece of software for software developers and even sys admins. Web server owners can track changes on certain directories when developing your servers or website, and the ability to easily revert is something that should not be looked over. Git is not the easiest software to work. However, it works well for what it is designed for.