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
unset GIT_DIR
#!/bin/shcd /path/to/working-copy/ || exitunset GIT_DIRgit pull repo branchexec git-update-server-info
Try instead:
#!/bin/shcd /path/to/working-copy/env -i git pull
Despite that unset GIT_DIRjust works.
the problem occurs when you set GIT_DIR wrongly somewhere else.
you can just add that instead:GIT_DIR=.git/It will work