Git server-side "pre-receive" hook (BB-11418)

Issue #10471 open
Maxim Novikov
created an issue

There are multiple cases when development teams want to check the push to the remote repository and either accept or reject it. Some may check branch names, commit messages, fast-forward merges, etc. to ensure the development process follows some particular rules.

Currently, it does not seem to be possible with Bitbucket to use this functionality that actually comes out of the box with Git. The user does not have access to the actual remote repository to manage that. However, it can be provided in a different way using the approach similar to Bitbucket Hooks' POST request. When the repository gets triggered on "pre-receive" event, it could execute HTTP POST request supplying all the information from the push, and accept it if the POST request returns 200 or reject if any other HTTP code. This would still not require to provide direct access to the remote repository, but the users could still handle commits and reject them using their specific rules.

PS Related but less generalized ticket:

Enhancement #5658 Allow custom pre-receive hook that rejects commits without an issue key in their message

Comments (6)

  1. Ferenc Kiss [Midori]

    Hi,

    This is exactly the concept that is now implemented by the Commit Policy add-on!

    This allow you to generate and install hook scripts to your local clones, with a simple to use wizard. Then at each commit, your changes are validated locally (by sending a request to JIRA and accepting or rejecting the change based on the returned result).

    Give this a free trial: https://marketplace.atlassian.com/plugins/com.midori.jira.plugin.jira-commit-policy-plugin/server/overview

  2. Sam Krishna

    +1 To be clear, we want this functionality for bitbucket cloud. Not bitbucket server which is also another product by atlassian and which already has this available.

  3. Log in to comment