Linux is a popular and as well as widely used operating system. The installation of Git on Linux is quite simpler when compared to other platforms. However, one has to use the right package manager for Linux distribution.
We will proceed with this tutorial to see how to install and set up Git on various distributions of Linux operation systems.
For Debian/Ubuntu
You will run the following command on the shell/terminal to install Git in Linux.
sudo apt-get install git
Now, confirm whether Git was successfully installed, use the to —
version command:
git --version
For Fedora, CentOS and RHEL
You will run the command below from the shell/terminal:
$ sudo dnf install git
But, in case you are using an older version then use yum instead of dnf:
$ sudo yum install git
For OpenSUSE
You will open the shell and run the command below to install Git on OpenSUSE:
$ sudo zypper install git
For Arch and its derivatives
You will run the pacman command below in the shell to install Git:
$ sudo pacman -S git
Thus, if the command above displays the Git version as shown below, then Git was
successfully installed.
$ git --version