How to Install Git on Ubuntu 20.04

Install Git on Ubuntu 20.04

In this article, we will have explained the necessary steps to install and configure Git on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Git is a free and open source distributed version control system. It is perhaps the most popular within the branch as millions of developers use it to control software versions. Ease of use, community support, and efficient version control are the main features of Git. In addition, it is open source and free, which makes it ideal for all projects.

Install Git on Ubuntu 20.04

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade

Step 2. Install Git on Ubuntu.

Now, install Git with the following command:

sudo apt install git

Or, lternative, Install Git on Ubuntu system using the official PPA:

sudo add-apt-repository ppa:git-core/ppa

Then, refresh the APT cache so when it’s done, just run it:

sudo apt install git

Once installed, run the following command to check whether Git is working correctly:

git --version

Step 3. Configuring Git.

First set the global user name for Git:

git config --global user.name "User Name"

Secondly set global email for Git:

git config --global user.email "YourUserName@domain.com"

You can verify the changes with the following command:

### git config --list
user.name=User Name
user.email=yourusername@yourdomain.com

The configuration settings are stored in the ~/.gitconfig file:

nano ~/.gitconfig
[user]
    name = Your Name
    email = youremail@yourdomain.com

That’s all you need to do to install Git on Ubuntu 20.04 Focal Fossa. I hope you find this quick tip helpful. Kindly share your valuable suggestions/queries in the below comment box and leave your worthwhile feedback.