How to Install Git on Ubuntu 18.04 | 20.04

How to Install Git on Ubuntu 18.04 20.04

In this article, we are going to shows how to Install Git on Ubuntu 20.04 | 18.04 . If you are interested to Install Git on your Ubuntu system then this post is ideal for you.

Git is a free, open source and popular version control system designed to track changes in source code for many open source and commercial projects. With the help of it, you can keep tracking of your code changes, revert to previous stages or revert the changes that you made, create branches and sub-branches, and also allow you to collaborate with your fellow developers.

Ubuntu is a Linux Operating System based on Debian and mostly composed of non-profit(free) and open-source software. It is a complete Linux operating system that compatible with desktops, laptops, server and other devices. Ubuntu is Open Source so it is freely available for both community and professional support.

if you are a learner and looking for a Linux distribution for Learning then Ubuntu Linux Operating System is best for you as a beginning.


How to Install Git on Ubuntu 18.04 | 20.04

Simply follow below methods to install Git on your Ubuntu machine :

Method 1 : Install Git Via Apt

Installing via apt package management tool from Ubuntu’s default repositories is the easiest way to install Git.

First of all, update the default package index:

sudo apt update

After that, run the command below to install Git:

sudo apt install git

To verify the installation of Git, run the command below:

git --version

The command above will display the current version of Git:

Output
git version 2.32.0

Method 2 : Install Git from the Source 

You can also install the Git from the source which will allow you to install the latest Git version. To install Git from the Source, simply follow below steps:

First, install the required dependencies to run Git:

sudo apt update
sudo apt install make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip

After that, open your browser and download the latest release of Git in the /usr/src directory:

sudo wget https://github.com/git/git/archive/v2.32.0.tar.gz -O git.tar.gz

You can visit the Git download page to check the latest release of Git.

Next, extract the tar.gz file and change the director to the Git source directory by running the command below:

sudo tar -xf git.tar.gz
cd git-*

After that, run the command below to compile and install Git:

sudo make prefix=/usr/local all
sudo make prefix=/usr/local install

To verify the installation of Git, run the command below:

git --version
Output
git version 2.32.0

That’s all

If you face any error and issue in above steps , please use comment box below to report.

If our tutorials helped you, please consider buying us a coffee. We appreciate your support!

Thank you for your support.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.