How can I implement a commit policy in my Bitbucket Cloud?

Ci Admin February 25, 2021

There is a commit policy plugin for Bitbucket server and data center but I can't find anything for cloud. I need to implement a specific format. In order to link our JIRA issues to the commits we're focusing on smart commits. But in order to enforce the smart commit policy I need to set up a gate so I only commit with proper format followed go through.

3 answers

1 vote
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 8, 2021

Hi @Ci Admin ,

I'm afraid that this is not possible in Bitbucket Cloud. We have an option to enforce JIRA issues keys in commit message (it can be found in Repository settings > Links), but we don't support server side hooks at the moment that would allow rejecting commits based on the commit message format.

We have a feature request for a server-side pre-receive hook that you can vote for, add yourself as a watcher and also leave any feedback:

In the meantime, the suggestion I can make as a workaround would be to use client side hooks, you can check an example here:

These will need to be configured by every user in the local clone of the repo they are working on, in the .git/hooks directory of the local repo. From the link I included above:

Because hooks aren’t transferred with a clone of a project, you must distribute these scripts some other way and then have your users copy them to their .git/hooks directory and make them executable.

Please feel free to let me know if you have any questions.

Kind regards,

0 votes
Saxea _Flowie_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 20, 2024

We have added commit policy support to Flowie, a Bitbucket Cloud addon. It creates checks against the commit message.


0 votes
Levente Szabo _Midori_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
March 18, 2021

Hi @Ci Admin 

Do you use Jira in Cloud as well (at all?) In the off chance that you also use Jira Server or Data Center, you can implement (have your developers install) a local commit verification hook script that would enforce your rules. Read more on this here.

I know it's a cumbersome workaround and only works if you have Jira Server/DC, but it's the best we could come up with until BCLOUD-10471 is not implemented.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events