It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Stash Post hook not firing for some repositories?

Jacob Schoen Apr 29, 2013

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
Charles O'Farrell Apr 29, 2013

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?

Jacob Schoen Apr 29, 2013

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.

Jacob Schoen Apr 29, 2013

@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.

Charles O'Farrell Apr 30, 2013

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.



0 votes
Florian Cavagnini Jul 16, 2013


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?


Charles O'Farrell Jul 17, 2013

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
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Posted in United States

Topic Tuesday: Agile

Another week, another Topic Tuesday!  Agile has been on my mind a lot lately because I've seen good implementations and bad implementations, but now as a Jira admin it matters more to me whether...

14 views 0 0
View post

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you