Issue #5658 open

Allow custom pre-receive hook that rejects commits without an issue key in their message (BB-2415)

Peter Meyer
created an issue


We recently went from Jira OnDemand SVN to Git on BitBucket.

One thing we miss alot, is the ability to demand users entering a Jira issue key, when checking in code.

I know that Git is distributed, and a lot of the checkin/commit stuff is handled locally. But if i Jira issue check was done by BitBucket, no code could be added to "final destination" without an Jira issue key defined in the commit description.

So this feature request is, that you possibly come up with a clever idea for this :o)

Best regards Peter Meyer

Comments (116)

  1. Prisdha Dharma

    This custom pre-receive hook would be very useful for our projects as well. Since subversion can do this, git should be able to accomodate something similar.

  2. Doron Gill

    ultra important enhancement. For on-demand customers especially it is unacceptable that Atlassian is pushing us towards bitbucket (e.g. end-of-lifing Crucible) and on the other hand not being able to maintain functionality

  3. Brett Cave

    +1 - this is the primary reason for us holding back as long as possible on SVN to Bitbucket migration. It's critical for large development teams, as a control for ensuring quality and auditable code!

  4. Andreja Milenkovic

    +1. This is very important feature that everyone expect from Atlassian integration team. Everybody sometimes forget or mistype issue key and that commit is not properly linked to JIRA.

  5. Brett Cave


    looks like the most popular issue for bitbucket right now, and there's a reason for it. Any feedback on when this will be added to bitbucket? Less than 3 months left until Atlassian shuts down Subversion and we need to migrate. This is currently the only solution that would cater for many companies' requirements, by the looks of it.

  6. Rich Mayfield

    Kind people of Atlassian, please make this a part of your product roadmap.

    Or... at least tell us why you will not include this on your roadmap. When a vendor removes functionality it's typically either for a good reason, or they are plain blind to the fact that people really, really need it.

  7. Martin Geisler

    To Avichay Eyal oferbu2 Yuval Pemper Eyal Zach Jernej Tonejc et al: your "+1" comment was sent by mail to all 67 watchers of this issue. Please just use the new vote functionality instead to show your interest in the issue.

    Have the people asking for this thought about setting up a local mirror instead and simply checking the commits there?

    In my company, we employ a local mirror for our repositories to speed things up (0.5 sec vs 3 sec) and this would also be the ideal place for us to install any hooks we might want: since it is a local server we have control over it and can do any checks we want.

    Unless you want a very simple regexp check for the commit messages, I feel that a local mirror is the best way to go since Bitbucket might not implement exactly what you want anyway:

    • Do you need an issue for merge commits too?
    • What about commits by the release manager?
    • Bugfix commits on a stable branch?
    • Commits that only touch the /contrib directory?

    Unless Bitbucket makes this very flexible, I think a fair amount of you will have to implement the hooks yourself.

  8. Martin Geisler

    To Carrie Jenkins Julie Ricci Joe Jongue Lee Trevena @acorbino and all the others who add "+1" comments on this ticket: please stop!

    Your unhelpful comment is sent to the 101 others who are currently watching this ticket. We don't need to see five mails per day saying just "+1", we want to see an interesting discussion about the ticket. You should instead use the vote feature Bitbucket implemented a while ago. That will show your interest in the topic without spamming everybody else.


    To make this a little relevant, have anybody thought about the issues I brought up above?

    This feature seems like one that is better implemented in your local mirror. Otherwise the Bitbucket team will have to build in controls to let you say if you want merges to be considered too, if it should apply on all branches, for all users, etc. That is, a one-size fits all solution might not really fit all — people who want to lock their repository down like this clearly have non-standard requirements and so it is not certain that a standard solution can work for them.

    Also, this is a problem that you can solve on a technical level (with custom code) or on a social level: simply sending a mail to your developers once per week with the names of the offenders can do wonders.

  9. isopov

    For all who is bothered with "+1" comments - you can vote for the issue to forbid them.

    If we wanted to use a local mirror - we would not use bitbucket. We'd use our own git server instead. Personally I don't need really custom pre-recieve hooks - some amount of reasonable non-configurable basic options will make me happy. (Actually there are already some in "branch management")

  10. Nicolas Cadou

    It's pretty funny that the ticket requesting pre-receive support to filter out crap commits ends up being so popular that there has to be another ticket requesting a pre-receive hook of sorts for comments, to filter out crap "+1" comments.

    Funny and ironic. :)

    It just shows that when you face uncontrollable behavior, pre-receive hooks are pretty damn useful, and having bitbucket support that would be awesome.

    So, +1 here. I would myself use it to enforce a no-merge-commits policy for selected branches, to ensure merged branches were properly rebased beforehand. I'm obsessive about clean straight history lines as you can tell. :)

  11. Nicolas Cadou

    Martin Geisler the whole point of using bitbucket/github/whatnot is to not have to set it up yourself. There may be other advantages but for most small teams I suspect that's pretty much it. Even though installing a public gitlab service is not that hard (and gitlab is loaded with features, so it would probably not be a step down from bitbucket for most people,) I'm pretty happy to just use bitbucket as the no-hassle central repo I can point everyone to. If I have to set up an intermediate repo so that I can use pre-receive hooks, then accounting for bitbucket would become as much a hassle as it would become entirely unnecessary.

  12. Stephen Coetzee

    Martin Geisler Very much what the others are saying. If I wanted to self manage a git backend, I wouldn't have needed bitbucket. But with having small development teams in several countries, that would have necessitated a VPN setup into the works too, with accompanying firewalling and training for using the several additional layers of systems.

  13. Justen Stepka

    Official update:

    Internally at Atlassian we've expressed in interest in developing this feature as it would greatly help our teams develop software. That said, our focus for the short to medium term, will be to provide SSO and better user management with our OnDemand JIRA and Confluence products. This project will take us into the early part of 2014 -- that said, if we can find an extra development cycle I will be sure to keep this item on my short list of potential quick wins.

    Cheers, Justen -- Bitbucket product manager

  14. Dan Fabulich

    I filed issue #8286 (Block commits by regular expression) as a fork of this bug. I understand that supporting arbitrary pre-receive hooks might be expensive, but all we need is the ability to block commits that do/don't match a regular expression, which should deliver 80% of the value at 20% of the cost.

  15. Nikhil Gupta

    It is creating a lot of confusion for the teams that have moved from jira on demand svn to git. Now the team adds a jira issue and it always goes through without checking if the issue is open or not.

    Teams like us, who have the release workflow depending on this are facing unforeseen issues due to this. Should have been fixed yesterday!!!

  16. Mike Schinkel

    If people keep posting +1 instead of (or in addition to) voting then obviously it is the UX on this page that is to fault and/or simple voting does not offer people what they are interested in.

    Being the 3rd or 4th person to admonish existing posters about posting +1 won't cause new people to stop doing it, especially if they are doing so others can see their name associated with their "vote" vs. just voting.

    The only way the +1s will stop is if Atlasssian reworks their interface to provide an alternate solution to address why people keep posting +1s.

    FYI, it's very non-obvious that voting is even possible; it's a tiny link buried in a sidebar box with several other non-descript links. If this is an issue that Atlasssian cares about (vs. people who are complaining about it )they should change to a BIG VOTE BUTTON at the top and also next to the comment button, and they should display a list of all avatars of people who voted so they will "feel" like their vote actually got counted.


    P.S. Also it's an easy fix for us. If the +1s annoy you too much, just click the "Stop watching" link.

  17. Brett Cave

    I agree with you Mike - I stand to be corrected, but I remember looking for a Vote link when I initially wanted to vote for it in June 2013 and not seeing it. Not sure if the Vote feature was added since then, or whether it was oversight.

    New voters are now following the old pattern - is it not possible for the original issue to be modified to include a note on how to vote? There's been a handful of comments asking people to stop +1'ing in the comments, but it doesn't seem to be effective.


  18. Abdul Ismail

    yes, also; it's so hard to find that vote button once it appears there, could we please get a nice big, green .ico on issues to be voted on so it can attract enough attention to it that noobs don't have to go on a wild goose chase for it. thanks.

    I also commented '+1' first, also if I have to login/watch the issue to vote, make that obvious as well please

  19. Sam Kellett

    Maybe this is a good real-life scenario to push for a feature request that if a user comments with just a '+1' then instead of adding a comment, bitbucket will add a vote. I think it's always a good thing to do to change the functionality of a system around how it is used rather than trying to force people to do something different.

  20. Wade Chia

    Justen Falk It's now almost Q4 2014.

    Is this going to be moved to your " short to medium term" roadmap anytime soon?
    Are we really going to have to wait 2+ years for this? I guess if you wait long enough, it will become someone else's problem...

  21. Yoganandhini Yoganandan


    Thanks for writing in!! I am on medical leave. Please contact:

    Thanks, Yoganandhini Y. This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.

  22. Jörg Lehmeier

     Vielen Dank für Ihre Nachricht,

    ich bin bis einschließlich 03.04.2015 nicht im Büro. In dieser Zeit werden Mails, die an diese Adresse versendet wurden, nicht bearbeitet.

    Ab 06.04.2015 stehe ich Ihnen wieder zur Verfügung und werde Ihre Nachrichten beantworten.

    In dringenden Fällen wenden Sie sich bitte an unser Support-Team unter oder telefonisch unter 0911 / 37 84 37 - 20.

    Bezüglich Vertrieb und Marketing vertritt mich Frau Zweschke oder telefonisch unter 0911 / 37 84 37 - 0

    Vielen Dank für Ihr Verständnis.

    Jörg Lehmeier Dipl. Wirtschaftsinformatiker Geschäftsführer

    Unternehmenssoftware & innovative Betreuung

  23. Michael Bean

    I'd like the option to make this only a requirement of non-merge commits since we have some branches that don't have issues related to them because they correspond to which server uses the branch. I'd still like to push those branch or those commits to branches.

    Does that make sense?

  24. Benjamin Paz

    The ability to reject commits in the server side repository is essential. We need this capability for the update hook. Without this feature we will be obligated to use a non BitBucket approach. Please solve soon.

  25. Wade Chia

    Jan Matějka don't be sorry, this issue is a massive #fail on bitbucket's part, IMO and I haven't heard the "s" word from them.

    can u share your experience here with regards to mirroring? Did you consider github instead for mirroring?

  26. Scott Carpenter

    This is a problem as our team grows, and given the existing Jira integration to link through issues it is the logical next step to include a hook to prevent commits without issue keys.

  27. Kyle Anderson

    I deal with this all day long with my overseas dev team. I can't monitor all their machines for local git hooks...server side is the way to go. I basically rebase every single feature branch once they create a pull request and amend the commit messages where they forgot the issue key. Such a waste of my time, but necessary for large projects.

  28. Log in to comment