Git on CentOS

Git is very popular source code management (SCM) system. It has replaced SVN as the preferred choice of coders. In this brief tutorial I will show you how to setup Git on your CentOS box, and start using it. First, install Git from source code, primarily because if you install from the yum repos you might get an older version. Git requires the following packages:

sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel -y

I already had a previous version of Git installed, so I was able to download Git source using Git. If you do not have Git installed, then you can install it using ‘sudo yum install git -y’.

git clone

Uninstall the old version of git, so that you can use the new version which you will build below.

sudo remove git -y

Now install some tools needed to make git:

sudo yum install make -y
sudo yum install gcc -y
sudo yum install cpan -y 
sudo yum install perl-DBI perl-DBD-MySQL -y #For MakeMaker

We are now ready to actually install Git, which is done as follows:

sudo make prefix=/usr/local all
sudo make prefix=/usr/local install

Now that you have Git installed, visit and create your free account. After that create a repo on using the steps here Next in your shell we will clone the above repo and create a file in it.

mkdir -p git && cd git
git config --global "syedaali"
git config --global ""
git config --global credential.helper cache
git config --global credential.helper 'cache --timeout=7200'
git clone
cd perlex
touch README
git add README
git commit -m "Adding README"
git push

Using git config I specified my username which I had created on I also specified that git should cache my credentials for 7200 seconds, so that I do not have to enter my username and password repeatedly. On I had created a repo called perlex.git, I cloned that using the ‘git clone’ command. After that I created a file called README, committed it to my local repo and then pushed it to the remote repo. For further reading visit

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s