I keep receiving remote: error: cannot open .git/FETCH_HEAD: Permission denied
when post-recive hook is executed
I have stash 2.4 setup to run as dedicated user so post-receive hook is being executed as a stash user.
Hook code
#!/bin/sh
echo "**** Pulling changes into Development Box ****"
echo "User name $USER"
echo
cd /var/www/dir || exit
unset GIT_DIR
git pull origin develop
echo "**** DONE ****"
exec git-update-server-info
I also use .netrc to authenticate stash user (correct access to repo) over HTTP. I'm able to pull with no problems using linux user who run stash if I do it manually but it doesn't work as a hook.