Git version controlling system is a handy tool when it comes to large, complicated, and distributed projects. It is used by the majority of organizations and developers to keep track of their code changes and managing teams.
Git, as an open-source tool, keeps on updating to add new commands and provide more functionalities. If you are on Ubuntu 18.04, then you might be facing some problems with running a few advanced Git commands.
This article is designed to guide the users of Ubuntu 18.04 as well as 16.04 to install Git for their system. The same instructions will work for any other Ubuntu-based distribution, such as Linux Mint,
Kubuntu, and Elementary OS.
Table of Contents
Installing Git with Apt [Recommended Way]
apt package management is a tool to install Git from Ubuntu’s own repositories. Follow the following steps to install Git on your Ubuntu system.
Step#01: Update Package Index
$ sudo apt update
Step#02: Install Git
$ sudo apt install git
Step#03: Verify Git Installation by Checking the Version
$ git --version
Installing Git from the Source [Latest Version Way]
Step#01: Install Dependencies to Build Git on Ubuntu
$ sudo apt update $ sudo apt install make libssl-dev libghc-zlib-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip
Step#02: Go to the Main Directory
After you are done with the installation, go to the /usr/src directory because that’s where we will place our new Git installation file. To do so, run the following command:
$ cd /usr/src
Step#03: Download the Required Git File
$ sudo wget https://github.com/git/git/archive/ v2.31.0.tar.gz -O git.tar.gz
Step#04: Extract the File
$ sudo tar -xf git.tar.gz $ cd "git-2.31.0"
By the time of writing this article, the latest Git release is v2.31.0. However, you can replace the version number with the Git release you want to use.
Step#05: Execute the File
$ sudo make prefix=/usr/local all $ sudo make prefix=/usr/local install