I'm new to git so I apologize (and please correct me) if I misuse terminology here, but I'll do my best.
I'm trying to set up a bare git repo (hub) and a development site working copy (prime) on a web server. I've tried to pattern it after this article. I want the development working copy to be updated whenever the hub repo is pushed to. I'm under the impression that the proper hook for this is post-update
, which I have created like so:
#!/bin/sh
whoami
cd /path/to/working-copy/
RET=`git pull`
echo $RET
When I push changes from my local repo to the bare hub I get the following output from the post-update script:
remote: sites
remote: fatal: Not a git repository: '.'
However if I SSH into the server as user 'sites' and execute this script manually it works great Any ideas as to what might be going wrong with this hook or script?
Here is the script that ultimately worked. I think the bit I was originally missing that prevented it from working remotely was the unset GIT_DIR
#!/bin/sh
cd /path/to/working-copy/ || exit
unset GIT_DIR
git pull repo branch
exec git-update-server-info