Linux

Installation of Git on Linux.

Note:

Most installation commands require root privileges. Make sure you have sudo access or run them as root.

Debian/Ubuntu-based

sudo apt-get update
sudo apt-get install git

If you are using Ubuntu 20.04 or later, you can use the following command to install Git:

sudo apt install git

Fedora

sudo dnf install git

Arch Linux

sudo pacman -S git

OpenSUSE

sudo zypper install git

Gentoo

sudo emerge --ask --verbose dev-vcs/git

Alpine

apk add git

Verifying the Installation

After installation, you can verify the installation by running:

git -v

Or

git --version

If Git is installed, it should show something like git version X.Y.