Install Git on Hostgator shared hosting
After hearing my colleagues talking today about how cheap the VPS got in the last few years, I almost convinced myself that I have to switch. But I've decided to give my old shared hosting package from Hostgator another try. Buying a VPS package only to install Git is not the smartest thing to do, as you can get better and cheaper services from source code hosting providers like github.com or bitbucket.org.
Enable the SSH access
Enabling SSH access for a Hostgator access is really simple. You can learn more about it by reading my article about this subject:
Enable SSH access on a Hostgator shared hosting account
Install git
Git won't be available system wide, and you can't install it from source either. You can't compile Git remotely, because you won't have access to a compiler from within the jail shell. The only option left is to compile the git package from sources on a different machine with the same configuration as the one used by Hostgator for its shared hosting packages.
After a little research I've found that Hostgator is using CentOS 5.5, the 32 bit version. If you don't have a CentOS machine available, you can download a preinstalled Vmware image or you can install the system yourself. If you want to go the "do it yourself" way, then check my previous posts about installing CentOS 5.x and compiling Git:
If you just want to get to the next step quickly, just download the binary package attached to this post. It was compiled on a 32 bit version of CentOS 5.7.
Upload the binary package to Hostgator and unzip it somewhere in your home folder. I've called it /home/kenjiru/apps in my case.
Setup the environment
The last step is to let the shell know about the location of the git binary. You can do that by editing the ~/.bash_profile and appending the location of the git distribution to the PATH environment variable.
PATH=$PATH:/home/kenjiru/apps/git/bin
Give it a try
Now you can use Git as you would normally do on your machine. On the remote server you can issue commands like:
git clone git@github.com:kenjiru/test.git
You can also push to a remote repository hosted on the shared hosting. You will have to additionally specify the custom port that Hostgator uses like this:
git remote add origin ssh://kenjiru@kenjiru.ro:2222/~/git/test.git
Also notice the format of the remote path.
That's pretty much all. I hope this tutorial helped you.
| Attachment | Size |
|---|---|
| 9.18 MB |

Add new comment