Installing Git on CentOS 5

I have made the switch from SVN to Git for all of my projects and I’m loving it. So I decided as part of my deployment process, I would install Git on my server and use Git to fetch the release code to the deployment folder. This is alot like I did with Subversion, using svn export to push a tagged release to the server. Installing Git was quite simple even though there is no package for CentOS 5 yet. Here is the process I used to set it up.

The following packages are dependancies for Git, so make sure they are installed.

$: yum installĀ zlib-devel
$: yum install openssl-devel
$: yum install perl
$: yum install cpio
$: yum install expat-devel
$: yum install gettext-devel

Next, if you do not already have Curl installed, follow the next step to get it up and running.

$: wget
$: tar xzvf curl-7.18.0.tar.gz
$: cd curl-7.18.0
$: ./configure
$: make
$: make install

Next, make sure /usr/local/lib is in your, this is required for git-http-push to correctly link up to the Curl version you are installing.

$: vi /etc/

(Insert the following)


Save the file, then run:

$: ldconfig

Now download and install Git

$: wget
$: tar xzvf git-latest.tar.gz
$: cd git-{date}
$: autoconf
$: ./configure --with-curl=/usr/local
$: make
$: make install

Thats all there is to it! Simple enough. I will post a follow up on how I actually deploy using Git in the near future.

33 thoughts on “Installing Git on CentOS 5”

  1. Thanks! Worked for me on a Rimuhosting CentOS5 install. Only exceptions were:

    -I had to install autoconf:
    sudo yum install autoconf

    -ldconfig was not in my path, so I executed:

    -curl was already installed, so I had to modify the path to curl to configure:
    ./configure –with-curl=/usr/bin

    Cheers :)

  2. If you already have curl installed in /usr/bin then the configure command should be:

    ./configure –with-curl=/usr


    ./configure –with-curl=/usr/bin

    Please correct me if I’m wrong.

  3. Everything looks good for a newbie except for they need to install autoconf (yum install autoconf) otherwise they won’t be able to do that step. So you should put that line in or in a parenthesis that autoconf needs to be installed.

  4. Thank you for the directions. I was surprised git is not included in the default rpm repos. After installing autoconf this install from source went fine. Thank you!

  5. Thanks this also worked for me – I too had to use the ./configure –with-curl=/usr command as I already had curl installed.

  6. alwhen i reached the
    ./configure –with-curl=/usr/local
    i got a “configure: error: no acceptable C compiler found in $PATH”
    i first had to get gcc installed
    yum install gcc

  7. Yeah works fine. But if you have centos5 min image installed you need some more packages. In my case the following ones:

    yum install gcc make autoconf

    Notice: curl was already available thow yum. ==> yum install curl // works fine for me…

    All other packages I had already installed…
    THX for your work :)

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>