How to Install Git on Ubuntu 20.04 | 18.04 With Examples

Install Git on Ubuntu 20.04

In this simple guide, we show you how to install Git on Ubuntu 20.04 with practical examples from default reps as well as the PPA sources.

Git is a distributed version control system for tracking changes in any files. It is a popular system among programmers to help in coordinating work through cooperation on source code throughout the software development process. This results in speed, data integrity, and support for distributed, non-linear workflows.

You can always install Git packages from the default apt repositories. This may be okay unless you want the latest version available.

The Git core team also maintains a PPA with the latest git Debian packages. You can add this PPA to your system is you need to install and maintain the latest Git version.

Install Git on Ubuntu 20.04

Use the following steps to install Git on Ubuntu 20.04 or older versions.

  1. First, install software-properties-common package on your system if it is not yet installed.

$ sudo apt install software-properties-common -y

  1. Add the Git-core PPA to your system using the following command:

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

  1. Next, install git package on your system using the following command:
Read Also  How To Install Python 3.9 on Ubuntu, Debian, or Linux Mint

$ sudo apt install git -y

Git has been installed on your Ubuntu system.

Additional Steps

We will have to do some post install setup to get things running more efficiently.

We will set up the Git user details on your Ubuntu system that will be used as your identity by repository providers such as GitHub, GitLab, and others. We will be setting the name and email address. This can be done by running the two commands as shown below using your preferred name and email.

$ git config --gloabl "Example User"
$ git config --gloabl "[email protected]"