Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
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

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

Edited

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.

2 answers

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.

0 votes

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,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
Community showcase
Published in Bitbucket

⭐ Calling all Bitbucket and DevOps experts: Special showcase opportunity ⭐

Hi, Bitbucket community! Are you a DevOps practitioner (or know one in your network)? Do you have DevOps tips, tricks, or learnings you'd like to share with the community? If so, we'd love to hea...

1,477 views 4 7
Read article

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