I am trying to create a post update script and use git as a deployment tool on a remote server.
My post-update script looks something like this
git update-server-info
for ref in $@;do
echo $ref
if [ "$ref" = "refs/heads/production" ]
then
ssh [email protected] GIT_WORK_TREE=/home/www/test git checkout -f production
fi
done
However, when I run that, an error comes back that says:
Not a git repository (or any of the parent directories): .git
Which doesn't make any sense because I am able to run git commands from within the directory over ssh.

Is there something else that I need to be doing in my post-update script?
Solution
I added the GIT_DIR variable, so now my command looks like:
ssh [email protected] GIT_DIR=/home/www/test/.git GIT_WORK_TREE=/home/www/test git checkout -f production