How to Install Git on CentOS 6 VPS

Git is fast becoming the defacto code versioning system used by professional developers.

Developed by Linux creator Linus Torvalds, Git is an open source, distributed version control system.

Being distributed gives it many advantages over it’s older rival SVN, being able to commit and create branches locally without access to a central server, to name just one.

It scales from massive projects with hundreds of developers right down to a one-man shop, perfectly.

As most deployments are now on VPS or cloud hybrids, they may not always come with Git fully installed.

Here’s how to install Git on a CentOS 6 machine., first using the easy method, then manually to get the latest version of Git.

Installing Git Using Yum

sudo yum install git

This does require perl to be installed on the server also.

If you get the following error “Requires: perl(Error)” then install Perl on the server first

sudo yum install perl

Installing Git Manually from Source Code

This is a little bit more hands on but will give you greater control and the latest version of Git.

The CentOS repository as of this article contains Git v. whereas the latest version of Git is which is quite a difference.

If you’re using Git repos collaboratively with other developers or companies then you want to make sure you’re using the most up-to-date version of Git.

Before installing Git we have to install the Development Tools from the CentOS repository which includes the compiler used to compile the source code.

sudo yum groupinstall “Development Tools”

We also need to install some other dependencies to get the Git source to compile and run.

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

Ok – now we’re ready to get the latest zip of Git from and compile it.

Create and move into a tmp folder in your home drive

cd ~md tmp
cd tmp
wget -O

With the file downloaded, unzip it and move into the folder git-master.

unzip git.zipcd git-master

Now we can make the configuration file, give it the parameters it needs and compile the source into a binary file we can run along with related docs.

make configure
./configure –prefix=/usr/local
make all doc
sudo make install install-doc install-html

The compilation will take a few minutes to run through to completion.

When finished run Git at the command line to make sure it’s installed properly.

git –version


git version 1.8.5.GIT

Once installed you can simply keep Git up-to-date by using itself to clone the repo into a new folder then run the build and install process again.  How handy!

git clone git://

Configuring Git

There is one last step to follow and that’s to configure Git with your details.

When committing files to a git repo it stores your name and email along with the commit information so that changes can be tracked back to a single developer.

These need to be set up otherwise Git my try and use your VPS username and host email for commits.

git config –global “Enter Your Name Here”
git config –global “[email protected]

The information is stored in a .gitconfig file in your home folder.

cat ~/.gitconfig

You can edit this information at any time.

Or you can check the information directly from Git

git config –list

[email protected]


Congratulations – you now have Git working on your CentOS 6 VPS.

Git is a totes amazeballs versioning system that can be use for things way beyond just code.

Explore and have fun.

Was this article helpful?

Keep In Touch


Wil is a dad, WordPress consultant, WordPress developer, business coach and mentor. He co-organizes the WordPress Sydney meetup group and has been on the organising committee for WordCamp Sydney since 2014. He speaks at many special events and contributes to the WordPress open source project. His likes are chillies, craft beer and electrogravitics.