Due to a server upgrade, my ‘staging environment’ hosting provider, Aspiration Hosting broke the self compiled version of Git I had running on the server, which meant I had to go digging once more to remember how I installed it without root access in the first place. Here it is so I (and potentially others) don’t have to do it again.
Essentially, what you’re going to be doing is compiling and installing Git from source. Sounds scary? Not really – just make sure you follow the commands below and all should be well.
Before you start
In order to install Git on a shared hosting you must have the following. If you don’t, you could ask your hosting provider to give you this access. They may surprise you and allow it – most (good ones) should.
- SSH access into your hosting provider
- Compiler access – test this by running the command gcc –version. If it returns a version number, you’re good to go.
All sorted? Let’s begin
Logged into your hosting and in your home folder, run the following commands;
(NB: You can find the latest Git source from here, so replace the link below with the most recent stable release)
curl -O http://github.com/git/git/archive/v188.8.131.52.tar.gz tar zxvf git-184.108.40.206.tar.gz cd git-220.127.116.11 ./configure --prefix=/home/$USER --with-curl --with-expat make -i make -i install echo 'PATH=$PATH:$HOME/bin' >> $HOME/.bashrc source $HOME/.bashrc
That’s it – providing all worked okay, you should now be able to run git version and be rewarded with ‘git version 1.8.3’.
Some notes on the above
Just in case anyone is interested.
Originally when I set Git up prior to the server upgrade, I used Joe Mailer’s article – ‘How to install Git on a shared host‘. This didn’t work for me since the server upgrade, because the hosting company did not have certain software packages I kept getting http/https helper errors during the make process.
I found another guide by Randall Kent here, but again – same problem.
Finally I found a Stack Overflow question that contributed the –with-curl –with-expat parameter in the configure and the -i flag in make which cured the problem.