GIT is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

GIT was created by Linus Torvalds in 2005 for development of the Linux kernel, with other kernel developers contributing to its initial development. Its current maintainer since 2005 is Junio Hamano.

There are two ways to install git, first one is to install it from source and second one to install an existing package for your platform

Installing from Source

  • To install GIT, you need to have the following libraries that Git depends on curlzlibopensslexpat, and libiconv.
  • For Debian/Ubuntu Based System
apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev
  • For Redhat Based System
yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel
  • When you have all the necessary dependencies, you can go ahead and download the latest git code.
  • Then, compile and install
tar -zxf git-2.9.5.tar.gz

cd git-2.9.5

make prefix=/usr/local all

sudo make prefix=/usr/local install
  • After this is done, you can also get Git via Git itself for updates
git clone git://git.kernel.org/pub/scm/git/git.git

Installing using package manager

  • If you want to install Git on Linux via a binary installer, you can generally do so through the basic package-manager tool that comes with your distribution
  • For Redhat based O.S
yum install git (up to Fedora 21)

dnf install git (Fedora 22 and later)
  • For Debian/Ubuntu based O.S
apt-get install git

OR

add-apt-repository ppa:git-core/ppa

apt update

apt install git
  • For Gentoo Linux
emerge --ask --verbose dev-vcs/git
  • For Arch Linux
pacman -S git
  • For Open Suse
zypper install git
  • For OpenBSD
pkg_add git
  • For Alpine
apk add git

My name is Linus, and I am your God.

–Linus Torvalds