I have a post-update hook on my server, such that when I
git push
it does a pull on the live web directory. However, while the push always succeeds, the post-update hook sometimes fails.
The hook is pretty simple:
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".
cd /var/www
env -i git pull
I'm pushing updates from a variety of places, but sometimes I have to login as root on the server and manuall do a
env -i git pull
I only have to do it 20% of the time though. Any ideas why it would fail randomly? Also, how would I get it to log error messages, since it might be running as someone who can't write to the file system?
cd ... git pull
) if the user has sufficient permissions to run the rest of the script, and if not, print an error and exit cleanly. – Zeke