By default Git is included in all the Linux distributions, Today I will let you know the easiest way to install Git on Linux using package manager.
Install Git on Linux using package manager
# Install Git to Debian based system # $ sudo apt-get install git # Install Git to RHEL/CentOS & Up to Fedora 21 system # $ sudo yum install git # Install Git to Fedora 22 & later system # $ sudo dnf install git # Install Git to Arch Linux system # $ sudo zyper install git # Install Git to openSUSE system # $ sudo pacman -S git
Install Git via PPA
Alternatively we can also install the latest version of Git to Ubuntu/Mint systems via PPA.
apt-add-repository ppa:git-core/ppa apt-get update apt-get install git
Install Git on Linux from Source
To install from source:
Install Dependancy to RPM based system # yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel gcc perl-ExtUtils-MakeMaker Install Dependancy to Debian based system # apt-get install libcurl4-gnutls-dev libexpat1-dev gettext libz-dev libssl-dev build-essential wget https://www.kernel.org/pub/software/scm/git/git-2.8.0.tar.gz tar -xzf git-2.8.0.tar.gz cd git-2.8.0 make configure ./configure --prefix=/usr/local make install # Install upgrade automatically in future # git clone git://git.kernel.org/pub/scm/git/git.git
Now you can check the GIT version:
$ git --version
That’s all to do.