1

I'm using Atlassian Stash to manage our code base, and I am trying to set up a git hook so that when I push up to the Stash repoistory, it then pushes the same changes into the repo we have over the web directory, so when you visit it in the browser it has the same code as in the Stash system.

So I've added a post-receive hook, which is getting called ok, but I can't seem to get past the "cannot open .git/FETCH_HEAD: permission denied" error.

As you can see from the screenshot attached, the script is being run on the server under the user "atlstash". The .git directory within the repository has the group "git", which has read and write permissions to everything. And the "atlstash" user is in that "git" group.

screenshot

So as far as I can tell, the "atlstash" user running the script should have permission to open that file...

Am I missing something obvious here?

Thanks

Edit:

If it helps, this is the script being run:

#!/usr/bin/env bash
echo "*** Pulling changes from Stash (hub) into Web Directory (prime)***"
echo "*** Running as user: $USER ***"

cd /var/www/html/moodle || exit
unset GIT_DIR
git pull hub master
exec git-update-server-info
CMR
  • 1,366
  • 4
  • 15
  • 31
  • You might consider using this plugin instead of writing your own hook: https://marketplace.atlassian.com/plugins/com.englishtown.stash-hook-mirror – Rog Aug 27 '15 at 23:24
  • Hi, i've tried using that and a few other plugins from the marketplace, but I've not been able to get any of them to work, I just get error messages: https://answers.atlassian.com/questions/24655565/errors-when-trying-to-use-post-receive and https://answers.atlassian.com/questions/24655484/pushing-to-another-local-repo – CMR Aug 28 '15 at 07:37

0 Answers0