Git is one an open-source & distributed version controlling system, that is used for tracking changes in files/code among multiple peoples/locations. It is the most used version controlling system that is being used by millions of users & almost all the organizations use it.
It is a distributed system that allows every repository on every system to act as a full-fledged repository itself with complete history & version tracking capabilities.
Recommended Read: Ultimate guide to install PYTHON from source
Also Read: Complete guide to install Anaconda on Ubuntu
It was created by Linus Torvalds for Linux kernel development. It is free software & distributed under the terms of GNU General Public License. In this tutorial, we will learn to install git on Ubuntu systems. So this tutorial should work for all Ubuntu versions. Here we will be discussing two methods to install git on Ubuntu, i.e.,
1- Using default package manager
2- Using source packages
Install Git on Ubuntu
1- Using default package manager
Git packages are maintained on the default package repositories for Ubuntu. They might not be the latest packages but they will be stable packages. So to install git on Ubuntu using apt, we can use the following command,
$ sudo apt-get update
$ sudo apt-get install git
This would install git on Ubuntu. If for some reason, you need the latest or any particular version of the git, then we recommend that you use the second method for git installation.
2- Using source packages
Before we proceed with git installation using the source packages, we must have all the required packages for the compilation of git source package. Install the required packages using the following command,
$ sudo apt-get update
$ sudo apt-get install build-essential libssl-dev libcurl4-gnutls-dev libexpat1-dev gettext unzip
Now we can either download a particular version or can also install the latest git version, for this tutorial i will be installing the latest packages. So first, we will download the latest packages,
$ wget https://github.com/git/git/archive/master.zip
The latest packages will always be available at the mentioned url. Next, we need to unzip the downloaded package,
$ unzip master.zip
$ cd master
Now compile & install git on Ubuntu with the following command,
$ make prefix=/usr/local all
$ sudo make prefix=/usr/local install
This will install git on your system. In order to use the Git, you can refer to git commands cheat sheet here. So this concludes our tutorial on how to install git on Ubuntu. Please do send in any questions, queries or suggestions using the comment box below.