Installing Git on a Shared Host

Git is a fantastic tool and is very useful for deployment. If you can’t install git system wide or don’t want to mess with installing it on the entire system here is an easy way to install it for a single user. This also works well on Mac OS X where installing git is more challenging than necessary. Script included

I used this script to install git on 1and1. The same script should work anywhere with no or little modification.

Preparation

Goto http://git-scm.com/download and get the link to the latest git release.

Script

You should be able to just copy and paste this (replacing the link with the one from git-scm.com)

mkdir git-download mkdir -p $HOME/bin/git
cd git-download
wget http://kernel.org/pub/software/scm/git/git-1.6.5.tar.gz # replace with your link
tar -xzf git-1.*.tar.gz
cd git*
./configure --prefix=$HOME/bin/gitlib
make
make install
echo 'PATH=$PATH:$HOME/bin/gitlib/bin/'  > ~/.bash_profile
echo 'export PATH=$PATH:$HOME/bin/gitlib/bin:$HOME/bin/gitlib/libexec/git-core'  > ~/.bashrc
PATH=$PATH:$HOME/bin/gitlib/bin