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. At the time this post was last updated, the most recent version was v1.7.0.1:
$ curl -LO http://kernel.org/pub/software/scm/git/git-1.7.0.1.tar.gz
Untar the archive and cd into the new directory:
$ tar -xzvf git-1.7.0.1.tar.gz
$ cd git-1.7.0.1
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
[words...]
Lastly, make and install:
$ make && make install
[lots of words...]
That should be it, check your installed version like this:
$ git --version
git version 1.7.0.1
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.


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
Does one need root access to install git as described in your article? Or simply a shared host with SSH access?
@draco you’re never going to have root access on a shared account. Installing to your user home folder on the webserver should work everywhere, so long as the standard unix compilers are available.
Many, many thanx for this tutorial.
I use Github for some personal stuff, but when I work on client code, it would be lovely if I had a remote repo to upload to.
I can’t thank you enough.
Hi Draco,
When I run the command ./configure –prefix=$HOME
I get permission denied error.
Do I have to change $HOME with the directory name or something?
I am new to Linux and shell.. Please help..
Hi, I’m trying to follow your path.
Unfortunately gcc does not seem to be accessible for me as an ordinary user:
- configure: error: no acceptable C compiler found in $PATH
- gcc -version
jailshell: /usr/bin/gcc: Permission denied
Is there any solution to this situation?
Can I install gcc in my homedir?
Thanks for replying, and thanks for the HOWTO!
Erwin
Worked like a charm, thanks much!
thank you for this post i was missing
./configure –prefix=$HOME
and was getting errors, thanks to your article, i
installed it finally ;)