Recently I ran into an article about using git to upload your site (see links at the bottom how to). But off course, this requires to have
git installed on your hosting. My host (via TurtleHost.be) does not have it. So I was thinking, why not install it myself. Idea sounded more simple than doing it… .
- You need to have ssh access to your server.
Before we can download
git, we need to know which Linux distribution your server is using. This is required so the
git executable will be able to use the correct libraries.
To find out which kernel your server is running, log in to your server via ssh and type the command:
On my server this returned
CentOS release 5.3 (Final).
Next thing we need to know if your server is running 32bit or 64bit. This we can verify with the command:
x86_64 indicates the server has 64bit kernel running.
i686 means it is a 32bit kernel.
Next we need to download
git from somewhere. Probably you can find it by searching it on a RPM repository. I found one on rpm.pbone.net. This site has a great search engine where you can find
git version for your server distro.
After finding a download link, again log in to your server via ssh and type the following commands:
Now you have the
.rpm on your server.
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:
This will create a
usr/ directory in currect directory. You best move this directory to your home root:
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.
~/.bashrc file with your favorite editor (
pico) and add the following line:
And that’s it. To activate this change, run
source ~/.bashrc or log out and in again.
You can use
git just by typing the
git command. But
git init might give a warning:
warning: templates not found /usr/share/git-core/templates
To avoid this warning I’ve added an alias to
git-init command is an alternative to
git init and will take the correct path for templates.
One problem caused me a headache when using
git to upload my site was het error:
git: 'index-pack' is not a git-command. The reason for this problem was that `$HOME/usr/libexec/git-core` was not added to the `$PATH` variable.
So now you have
git up and running on your server and you can use it to upload your site. Read about it: