Installing Git on CentOS 5

Posted by on Mar 14, 2009 in Development, Git | 31 comments

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.


  1. Rich says:

    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. Hates_ says:

    Thanks! I was surprised to find there wasn’t a git package yet.

  3. David Linsin says:

    Thank a lot for this manual! Even without no knowledge of CentOS I was able to install git in 10 minutes!

  4. David Beckwith says:

    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.

  5. Rob Hawkes says:

    Great tutorial. I’m a newbie at command line installations and I had Git up and running in no time. Thank you.

  6. Alfred Farrington says:

    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.

  7. Dave says:

    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!

  8. Gaurav Narain Saxena says:

    Your post inspired me to install Git in a VirtualBox virtual machine of CentOS 5 for my development environment.

    Thanks a lot, can’t wait for the next few posts you might have!


  9. Alex says:

    Thanks for this post, just worked like a charm for me. Although (I’m still pretty new to this), autoconf wasn’t needed in my case.

  10. Rich says:

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

  11. Steve Boyd says:

    Thanks for posting this. Worked for me as is!!

  12. yair says:

    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

  13. Brian Fritton says:

    Worked awesomely, thank you!

  14. J Toman says:

    Oh. the old-fashioned way, actually building the tool. Yeah, I remember when we did that. ;-)

    Thanks for the post.

  15. Jeff Block says:

    Awesome post! Thanks.

  16. Sharad Jain says:

    Saved me. Thanks!

  17. Dustin Burke says:

    You rock! Worked flawlessly, many thanks.

  18. Russoue says:


  19. dss says:

    Another option, would be to use the EPEL repository:

    All you need to do is this:
    rpm -Uvh
    yum install git

  20. penguinpuppy says:

    Thanks a million ran in a jiffy .
    P.S :- I wonder why are RPM’s still painful

  21. Paddy says:

    Awesome ….It was so simple and it worked perfectly for me on the Cent OS.

    Thank you!

  22. spletta says:

    I love when things work! Thanks for sharing.

    Centos 5
    Ruby (1.9.2)
    Rails 3

  23. Scott McDuff says:

    Thank you, super helpful!

  24. Kewin says:

    Thanks, I couldn’t have done it without you!

  25. Richard says:

    I had to yum install make

  26. James Aspinwall says:

    Thanks, thanks, thanks… Save me lots of time and trouble.

  27. Luis says:

    Yup, this worked better for me.

  28. Edward says:

    Thank You! I’ve follow the instructions in CentOS 5.7 Final and works great!

  29. Nurul Huda says:

    Nice tutorials

  30. Sensi says:

    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 :)


  1. » Blog Archive » Phantom JS on Centos5 - [...] [...]
  2. Installing GIT | - [...] Source This entry was tagged CentOS 5.6, Git. Bookmark the permalink. [...]
  3. Useful links | Unusual subroutines - [...] Git install on CentOS: [...]

Leave a Reply

Leave a Reply