The best way to set up Git in Ubuntu 18.04

by | Feb 21, 2023 | Uncategorized

A distributed revision control system is called Git. It is a computer software that facilitates collaboration among those who write other computer programmes. It was designed to move quickly for the same reason. It was developed by Linus Torvalds to aid in the creation of the Linux kernel. Junio Hamano oversees the development of Git at the moment. It is open-source, free software distributed under the terms of the GNU General Public License version 2. Your projects’ papers are kept up to date with Git in a Git repository. Git collaboration and improvement are promoted by websites like GitHub and GitLab. Let’s go on to the instructions for installing Git on Ubuntu 18.04 without further ado.


  • Root Access
  • System Running Ubuntu 18.04

How to Install Git on Ubuntu

Git may be installed in two different ways, and we’ll break each one down so you can choose the one that works best for you.

  • Installing Git with apt: Git is already available in Ubuntu’s default repository. The apt command makes it simple to install, but the version might not be the most recent.
  • Installing Git from source: Git can be built from source code, giving you the most recent version.

Git Installation Using apt

  • To update the default repository, first log in as root, then open a terminal and perform the provided command.

# sudo apt update

  • Enter the given command after typing it to install Git from the default repository.

# sudo apt install git

Use the provided command to check the Git version as a final step to confirm the process. For successful installs, the output will provide the program’s build version.

# git –version

Putting in Git from Source

  • To install the dependencies needed to compile Git from source code, use the provided command first.

# sudo apt install make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip

  • Using the provided cd command, change the directory where you wish to download the Git file after the installation is finished.

# cd /usr/src/

  • Now navigate to the official Git download website and copy the URL for the most recent release, version 2.39.0. Download the Git source file by running the provided command.

# wget

  • Following the download, the tar file is extracted using the provided command.

# tar -zxf git-2.39.0.tar.gz

  • After the extraction is finished, use the cd command to move to the folder.

# cd git-2.39.0

  • Run the supplied command to install Git globally.

# make prefix=/usr install install-doc install-html install-info

  • After that, you can use the version command to confirm the installation once more.

# git –version


Git is one of the most well-known distributed model manipulation systems in the world, to put it briefly. Compared to other version control systems, this adaptable tool offers many valuable capabilities and enables developers to make any code changes with the option to undo them if necessary. This post concluded with explaining how to install Git on Ubuntu 18.04 using source files and apt package management. Please get in touch with us using the form below if you have any further questions or insights.

Read Our Next Articles Joomla vs. WordPress: Which Is The Best CMS For Your Website?