Categories
Linux

How to Install Git on Ubuntu 20.04 LTS

One of the first things you should install on your Linux machine

Git is the most widely used decentralized version control system used in today’s software development world. Everyone from an individual developer to giant software corporations use Git in their software development processes.

Advertisements

From beginners to professionals, it has become necessary to learn how to use Git for every programmer. Services like Github and Gitlab have contributed even more to the use of Git.

In this article we will see how to install Git on Ubuntu 20.04, which is the latest version of Ubuntu.

Installation

Git is available in the official Ubuntu 20.04 repository in the package git. Before we get started, let’s first update the package list from the repositories.

sudo apt update
Advertisements

Now, run the following command to install the latest version of Git on your Ubuntu machine.

sudo apt install git

If you wish to use Git from a GUI instead of command line, two tools are available, one is gitk from the package git-gui, and other is qgit from the eponymous package. You can install either/both of these in the same way as git.

sudo apt install git-gui qgit

Note that the package git does not install the optional documentation package git-doc. You can install it separately if you want the complete Git documentation locally.

sudo apt install git-doc

This installs the documentation at the location /usr/share/doc/git. You can read the file README.md for information on how the documentation is organized.

Verifying the Installation

To verify if Git has been successfully installed, first run the following:

git --version
Advertisements

Thus, Git is successfully installed on your Ubuntu 20.04 machine. You can now proceed to initialize or clone a Git repository and start working.


We saw how to install Git on Ubuntu 20.04. If you are a developer and interested in source code of Git, you can download a source code tarball of any git version from here.

For more information and resources on Git, visit the official website git-scm.com.