Installing Git on a CentOS 5.5 server

A lot of people are realizing the benefits of using a distributed version control system such as Git over Svn or Cvs. I won't be discussing the pros and cons, just how I got it installed on a CentOS 5.5 server. If you'd like to install git on a laptop/desktop I suggest you follow the instructions for that at github, this link will redirect to the appropriate OS it detects that you are using, COOL! That page also has many very useful git links in the sidebar.
While I do have cpanel available on my server, I still like to use the command line for some jobs, such as yum install. A more resent version of git was definitely not available in the repos enabled on my server anyway and I really don't feel that adding a bleeding edge repo is a great idea for me, so I ssh'd into my server and became root, su not sudo.
First we need to make sure that any dependencies are already met and that you have a gcc compiler installed also.

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

Next we have to get the latest stable release of git. At the time of this post, the latest stable release of git according to http://git-scm.com is v1.7.4.1, so let's get that version.

wget http://kernel.org/pub/software/scm/git/git-1.7.4.1.tar.gz
tar xvfz git-1.7.4.1.tar.gz
cd git-1.7.4.1
make prefix=/usr/local
make prefix=/usr/local install

To test that that was successful, let's ask which git and check it's version.

which git
/usr/local/bin/git
git --version
git version 1.7.4.1

Ok, we're good. Next, for me at least is

  • A self signed or inexpensive cert for my server
  • Adding users and their public keys

What's else? How about a web interface for this installation. Ok, git comes with gitweb as part of the package, but I think we can do better. git.wiki.kernel.org has a long list of available web interfaces as well as gui's and tools. I will attempt to determine which is the best for me and my audience and post about that soon.
Enjoy!

Topics: