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
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_64indicates the server has 64bit kernel running.
i686means 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:
mkdir ~/git-download cd ~/git-download wget ftp://the.download.link/of/repo/containing/git-1.6.x.x.rpm
Now you have the
.rpm on your server.
rpm needs to be installed, but you won’t be able to use the
rpm installer because this requires root access. You can
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
variable. Doing this will make it possible to execute the command
git from anywhere. Open your
~/.bashrc file with your favorite
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
might give a warning:
warning: templates not found /usr/share/git-core/templates
To avoid this warning I’ve added an alias to
alias git-init='git init --template=$HOME/usr/share/git-core/templates'
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
not added to the