Joe Maller.com

How to install Git on a shared host

I got a lot of really positive feedback for my installing Subversion on a shared host piece, but now that I’ve mostly switched over to Git, I figured I might as well write a companion post.

These instructions are much simpler, the installation is fast, and, like most things Git, it just works.

As with my previous Subversion solution, this will be a barebones install. It’s almost certainly against the terms of your hosting plan to run any daemons. The purpose of this installation is to be able to push changes from remote repositories into the hosted repo, where the hosted repository may also serve as the source directory of the live website.

Installing Git

SSH into your webserver. I created a source directory to hold the files which made cleanup easier:

cd
mkdir src
cd src

Grab the most current source tarballs from the Git site or the new, prettier Git mirror site. At the time of this posting, the most recent version was 1.5.6.5:

curl http://kernel.org/pub/software/scm/git/git-1.5.6.5.tar.gz > git-1.5.6.5.tar.gz

Untar the archive and cd into the new directory:

tar -xzvf git-1.5.6.5.tar.gz
cd git-1.5.6.5

This next step is the only one that really seems to matter with regards to shared hosting. The Configure script needs to be told where to install, and because we’re on a shared host, Git’s files should be put into our home directory:

./configure --prefix=$HOME

Lastly, make and install:

make && make install

That should be it, check your installed version like this:

$ git --version
git version 1.5.6.5

It’s now safe to delete the src folder which contained the download and source files.

Note that these instructions do not install Git’s documentation man pages. Also, these instructions appear to work exactly the same on Mac OS X (only tested on 10.5.4), though the installer package is way easier and includes documentation.

Share This:
  • Digg
  • del.icio.us
  • Reddit
  • StumbleUpon

2 Responses to “How to install Git on a shared host”

  • Hi Joe,

    Saw your twitters:

    joemaller what are the workarounds for svn’s “Item already exists in filesystem” error message with git-svn dcommit? #git
    joemaller git-svn dcommit is ruining my morning.

    git-svn routinely ruins mine :) It mostly works, but when it doesn’t, boy oh boy!

    The specific answer:

    Go to your svn, and svn up. Then try rebasing / dcommitting.

    General strategy for git-svn. Do everything in git unless absolutely necessary.

  • My answer was dumb…. this one is much better:

    http://www.jukie.net/~bart/blog/20080916155113

Leave a Reply