Installing Git on CentOS 5

Posted By on Mar 14, 2009 | 30 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. 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 :)

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

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

    Post a Reply
  4. 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.

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

    Post a Reply
  6. 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.

    Post a Reply
  7. 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!

    Post a Reply
  8. 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!


    Post a Reply
  9. 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.

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

    Post a Reply
  11. Thanks for posting this. Worked for me as is!!

    Post a Reply
  12. 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

    Post a Reply
  13. Oh. the old-fashioned way, actually building the tool. Yeah, I remember when we did that. šŸ˜‰

    Thanks for the post.

    Post a Reply
  14. Awesome post! Thanks.

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

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

    Thank you!

    Post a Reply
  17. I love when things work! Thanks for sharing.

    Centos 5
    Ruby (1.9.2)
    Rails 3

    Post a Reply
  18. Yup, this worked better for me.

    Post a Reply
  19. Thank You! I’ve follow the instructions in CentOS 5.7 Final and works great!

    Post a Reply
  20. 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 :)

    Post a Reply


  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: [...]

Submit a Comment

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>