Categories: Linux

How to Install and Configure Git on Ubuntu 20.04

Git is a widely used OpenSource version control system for software development. It has been initially developed by Linus Torvalds and is e.g. used to manage the source code of the Linux kernel. Any type of software project can be handled in an effective way by using GIT, often in conjunction with the free GIT hosting service GitHub.

In this article, you will learn how to install and configure Git on Ubuntu 20.04 via the Command line.

Installing Git on Ubuntu 20.04

In this guide, we will install GIT using the official Ubuntu packages. The installation steps are done on the Linux command line, the terminal.

Step 01: Update packages

First of all, you need to open a terminal by using Ctrl+Alt+T keys from the keyboard then update and upgrade the apt package lists.

Execute the following below mentioned command for update APT:

$ sudo apt update

Then enter your password as you can see in the following screenshot.

Execute the following below mentioned command for upgrade apt:

$ sudo apt upgrade

Before the upgrade starts, the system will ask one question that do you want to continue then you need to press “y” for yes.

Step 2: Install GIT

The Git utility package is available in ubuntu’s software sources, which can be installed by APT. By just typing the following command, Git can be installed.

$ sudo apt install git

Git wants sudo rights to be installed so, enter the password and then press “y” to continue the installation.

Step 3: Check installed GIT version

When Git gets installed, you can check its verification with the following command in the screenshot.

$ git --version

Configuring Git

Git can be configured by using the terminal or command-line window. It needs a username, that acts as a bind name and an email address.

Step 1: Configure GIT

Use the following command to set a username, swap the content inside the “Mahwish Aslam” with your name.

$ git config –global user.name “Mahwish Aslam”

Step 2:

Run this command to set an email address, swap the content inside the “Mahwish.aslam95@somedomain.tld” with your user email.

$ git config –global user.email Mahwish.aslam95@somedomain.tld

Step 3: Check GIT settings

Given below command lists out the changes made to the Git configuration file as shown in the screenshot.

$ git config --list

Step 4 (optional): GIT config

If you want to edit the settings, they can be changed at any time by using the following command:

$ git config

Conclusion

Git is very easy to install on Ubuntu 20.04, you just need four commands to install and configure it. You just need an APT command to install the stable version from the Ubuntu repository.

Karim Buzdar

About the Author: Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. You can reach Karim on LinkedIn

Recent Posts

How to Install Magento 2 on AlmaLinux

Magento is a free and open-source e-commerce platform written in PHP. It is simple, easy…

1 year ago

How to Install ISPConfig Hosting Control Panel with Apache Web Server on Ubuntu 24.04

ISPConfig is an open-source control panel that allows users to manage multiple servers from a…

1 year ago

How to Test your Email Server (SMTP) Using the Telnet Command

As a Linux administrator, you may find it necessary to troubleshoot or test your Simple…

1 year ago

Managing Network Interfaces and Settings on Ubuntu 24.04 with nmcli

Ubuntu 24.04, like many modern Linux distributions, relies on the NetworkManager for managing network connections.…

2 years ago

Using Restic Backup on Ubuntu 24.04

Restic is a modern, open-source backup program designed for efficiency, security, and simplicity. It enables…

2 years ago

Installing phpMyAdmin on Rocky Linux 9 and Securing it with Let’s Encrypt SSL

phpMyAdmin is a popular free tool written in PHP intended to administer MySQL and MariaDB…

2 years ago