Installing Git on a shared webhost

This great article describes how to install git on a remote machine where you don’t have root access. It’s really useful if you want to use your web host’s server as a place to backup your code. You’ll need SSH access to the server though.

Just to make sure this information stays online, I’ve just made a copy of the article’s most useful part below:

This rpm needs to be installed, but you won’t be able to use the regular rpm installer because this requires root access. You can extract the rpm file with the command:

rpm2cpio git-1.6.x.x.rpm | cpio -imdv

This will create a usr/ directory in currect directory. You best move this directory to your home root:

mv usr ~/usr

Now we are almost there, we only need to add the directory to $PATH variable. Doing this will make it possible to execute the command git from anywhere. Open your ~/.bashrc file with your favorite editor (vim or pico) and add the following line:

export PATH=$PATH:$HOME/usr/bin:$HOME/usr/libexec/git-core

And that’s it. To activate this change, run source ~/.bashrc or log out and in again.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>