Install git from source on Centos 6

Just want the latest version of git but CentOS 6 doesn’t provide it using yum? Personally I needed this to install the completely awesome GitList

Quick note – If you’re here because you need to just install git you probably just want yum install git!

Before you start on this you should probably know that this will likely interfere with yum if you ever try installing git with yum or rpm.. In that scenario you should probably roll your own RPM and install it with the package manager.. I’ll end up getting round to doing so but for now I’ve not got the time 🙂

Just go ahead and install the requirements with Yum before continuing

yum install perl-ExtUtils-MakeMaker gettext-devel expat-devel curl-devel zlib-devel openssl-devel openssl-devel gcc-c++ make

Then grab the git source, extract it, move it to a nicer directory name, cd to said directory

wget -O git-source.tar.gz https://api.github.com/repos/git/git/tarball/master

tar zxvf git-source.tar.gz
mv git-git* gitsource
cd gitsource

Make it.

make prefix=/usr install

Try it out

git --version

Should be 1.8.2 or whatever the latest version is at the time you’re reading this. Now go on to Install Gitlist! 🙂

Git logo from Git-SCM.com

7 Comments

  1. For anyone who using CentOS 6.4 32bit (like me) perl-ExtUtils-MakeMaker.x86_64 should be changed to perl-ExtUtils-MakeMaker. Otherwise there will be an error duing make

    anyway, thanks for sharing this, Cohan!

    Reply

Leave a Reply