Stash Post hook not firing for some repositories?

I created a simple Stash Post Hook plugin to send an email when fired. It is working perfectly on one repository, but on another, it is not ever being triggered. It is configured in both repos exactly the same.

I added logging, and can verify that is is never fired at all in the problematic repo, while it is in the working repo.

NOTE: I just tried it for a thrid repo we have, and it does not work. So apparently it is currently only fired for a single repo at the moment, even though it is configured on three. Also worth mentioning is that all three Repositories are under a single project in Stash.

2 answers

1 accepted

1 vote
Answer accepted

Hi Jacob,

I'm assuming it's enabled in all three of the repositories?

While this should never happen, it sounds like the post-receive scripts that we rely on in Stash have (somehow) been disabled. You're not using the subgit plugin by any chance and/or using your own manual Git hooks? I would take a look at the repositories in $STASH_HOME/data/repositories/$REPOID and see if the hooks/post-recieve and hooks/post-receive.d/20_stash_callback files are all executable and look exactly the same. Short of that I'm afraid I can't think of anything that would cause your hooks not to fire.

You may want to enable debugging, do a few pushes that don't notify you, raise a support ticket and then attach a support zip.



PS. Is it possible to see the source of your hook just so we can test it here?

Yes they are all enabled (double checked that before posting, since it is usually the simple things I seem to miss). I'll follow your suggesting with checking the post receive hooks in the morning. We do not have the subgit, or any other plugins enabled actually.

@Charles Turns out the post-receive.d and pre-receive.d folders where not even in the 2 repos that were not working. The 2 non working repos, were also missing the hooks/post-receive and hooks/pre-receive scripts that call those in the folders. I copied all that over to the non-working repos, and now they work. Thanks for the help.

Hi Jacob,

Glad to hear it helped!

But I'm also a little worried that it happened at all. If the problem re-occurs with new repositories please raise a support ticket so we can investigate further.




I have the same problem, I added a post-received hook in stash for a repo, and it don't fire.

my hooks/post-recieve and hooks/post-receive.d/20_stash_callback files are all executable but look different the same:

exec $STASH_HOOK_CALLBACK git-post-receive "$@" <&0 >&1 2>&2 for 20_stash_callback

exec $STASH_HOOK_COORDINATOR hooks/post-receive.d "$@" <&0 >&1 2>&2 for post-receive

can you help me please?


Hi Florian,

Those look correct. Are you saying Stash is not firing your post recieve plugin. Just out of curiosity do branch permissions work? That is, if you add a permission for a branch and try to push does Stash reject it? If it does then something is wrong with your plugin, and you might need to post more details. If the branch permission doesn't block the push then something is wrong with your configuration - please create a support ticket and attach a support zip.



Suggest an answer

Log in or Sign up to answer
Community showcase
Published 7 hours ago in Opsgenie

Getting the Most out of Atlassian and Opsgenie Together

We’re excited to invite you to this action-packed webinar where we will demonstrate how to integrate Opsgenie’s powerful alerting and on-call management tools with your entire Atlassian stack. Mar...

15 views 0 0
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you