How to Install Git on CentOS

The Easy Way

sudo yum install git

git --version to make sure it’s installed.

Compiling from Source

Make sure you have sudo access.

Install Compilation tools

sudo yum groupinstall "Development Tools"

Instll Dependencies

CentOS 6.x

sudo yum install zlib-devel perl-ExtUtils-MakeMaker asciidoc xmlto openssl-devel

CentOS 7.x

sudo yum install gettext-devel openssl-devel perl-CPAN perl-devel zlib-devel

Fetch source files

wget -O git.tar.gz

Check Github Release page for the latest stable version. Or install teh latest -rc (release candidate) version if you are feeling dangerous. Latest stable is recommended.

Extract and go to folder

tar -zxf git.tar.gz && cd git-*


make configure
./configure --prefix=/usr/local


sudo make install

Check if working

git --version

Set up Git

git config --global "Your Name"
git config --global ""

To confirm that these configurations were added successfully, we can see all of the configuration items that have been set by typing:

git config --list Name