Last Updated: February 25, 2016
· gnrfan

Compiling latest git from sources on a CentOS box

First, you'll need to make sure you have all installed all the usual tools needed for compiling software from sources.

You can accomplish that with the following command:

yum groupinstall 'Development Tools'

Then, make sure you install dependencies that are specific to git:

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

Then, grab the latest source tarball with git's sources. Better go to the site but yourself and copy and paste the current link. If you just copy and paste my example you might end up installing and older version:

wget -c

Unpack the sources:

tar jxpf git-

Get into the folder, configure, compile and install:

cd git-
./configure --prefix=/usr --localstatedir=/var --sysconfdir=/etc --with-curl --with-expat
make install

Get rid of the folder. Perhaps keeping the tarball is fine, perhaps you can get rid of that too.

rm -Rf git-

And that's it. Now you can test the version of you shiny new git installation with this command:

git --version

You should obtain something like this as response:

git version