In this page


This page is about implementing Better Commit Policy with the Git version control system and Bitbucket Cloud. If you use Git alone (i.e. without Bitbucket Cloud), please see the Git page instead.

Bitbucket Cloud is a leading cloud-based hosting service for Git and Mercurial repositories. It should not be mixed with Bitbucket Server, another Atlassian product, which is a self-hosted solution for Git management, and which is also supported by Better Commit Policy.

Working with Bitbucket Cloud commit policies

The primary problem with Bitbucket Cloud is, that it does not allow users to customize the server-side hooks in their repositories. This is a deliberate design decision by Bitbucket Cloud, because freely modifying hooks could easily lead to bugs and security issues.

As Better Commit Policy integrates with Git using hooks, this is not possible to implement Better Commit Policy directly in the Bitbucket Cloud managed server-side repositories. Wait, just read on, because there is a viable solution though!

Please note that Bitbucket Cloud also has a concept of webhooks. Unfortunately, webhooks are designed to reject commits, either.

What you can absolutely do is executing the verification in the developers' own clone repositories! When all your developers install the hooks to their local clone repositories, then this scenario is essentially equivalent with installing the hooks to the blessed repository itself. This way you get the best of both worlds: hosting your repositories in the cloud, and verifying the commits pushed into that at commit time (in local clones).

Installing Bitbucket Cloud commit policies

The process looks like this:

  1. Create the commit policy.
  2. Send an email to all your developers and ask them to install the hook script for this policy to their local repositories.

Please note that a "share policy" feature that eases distributing and monitoring the hook script installation will be implemented soon. If this is valuable to you, please vote to the public feature request.

Has every team member installed the hook script?

First the bad news: this is not possible to strictly enforce the installation of the hook scripts. Why? If the hook script is not installed, then your Git is basically not talking to Jira, so Better Commit Policy cannot know about your repository at all.

Nevertheless, administrators still have the possibility to keep their eyes on the commits, to spot the ones that are eventually violating the policy. For example, if you know that the policy requires mentioning a Jira issue, and a committer is sending commits without that, then clearly: he forgot to install the hook script! Contact him and ask him to do so.

We have an idea for a creative solution for this problem, using a post-mortem mechanism to automagically detect these missing installations. If this is valuable to you, please vote to the public feature request.

No other limitations

Other than the inability to install directly to the blessed repository, all features of the Better Commit Policy for Jira work without limitations, also for Bitbucket Cloud managed repositories.


Ask us any time.