GIT on Ubuntu Linux

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.

Update packages

Execute the following below mentioned command for upgrade apt:

$ sudo apt upgrade

Install pending package updates

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

Continue with upgrading

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.

Install GIT

Step 3: Check installed GIT version

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

$ git --version

Check 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”

Set GIT user

Step 2:

Run this command to set an email address, swap the content inside the “[email protected]” with your user email.

$ git config –global user.email [email protected]

Set GIT email

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

Check GIT settings

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

Using 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.

How to Install and Configure Git on Ubuntu 20.04

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