In this page
Working with Bitbucket Cloud commit policies
Bitbucket Cloud hooks: the limitation
Bitbucket Cloud hooks: the solution
The ultimate solution
Installing Bitbucket Cloud hooks
Installing Bitbucket Cloud hooks for local verification
Bitbucket Cloud commits
Overview
This page is about implementing Better Commit Policy specifically in Git repositories hosted by the Bitbucket Cloud service. If you use Git, but not Bitbucket Cloud, please see the general Git guide instead. Or, if you use Bitbucket Server, not Bitbucket Cloud, see the Bitbucket Server guide instead.
Working with Bitbucket Cloud commit policies
Bitbucket Cloud hooks: the limitation
Bitbucket Cloud is a public cloud-based service operated by its own team. Being a managed service, it doesn't give access the filesystem where the central repositories are stored, therefore you cannot manually install Git hooks to those. Bitbucket Cloud has no web-based feature to manage Git hooks, either.
It means that Bitbucket Cloud does not allow using custom server-side hooks currently.
As Better Commit Policy relies on server-side hooks for server-side verification, you can implement Better Commit Policy only in the local repositories for Bitbucket Cloud at the moment.
There are no other limitations. All features of the Better Commit Policy app work 100% also for Bitbucket Cloud hosted repositories.
Bitbucket Cloud hooks: the solution
To work around the limitation caused by missing server-side hooks, use local hooks consistently.
Note that it is possible to reach the same level of safety by using local hooks only as by using server-side hooks. For that, all developers in your team should activate local verification in their local repositories. It guarantees that only verified commits will be pushed to the central repository hosted by Bitbucket Cloud.
The ultimate solution
Although the current solution works fine, we will absolutely implement server-side verification also for Bitbucket Cloud as soon as they support custom server-side hooks. Note that only the Bitbucket Cloud team can remove this blocker.
To indicate its importance:
- Please vote for the Bitbucket Cloud feature request! As it takes only 2 minutes of your time, absolutely do this. The more votes, the higher probability it will be implemented.
- Also, there is a counter-part feature request at Midori. Although the Bitbucket Cloud feature request must be solved first, we use this one to collect feedback and interest on our side. Vote for this by clicking the "thumbs-up" icon, add your use case as a comment and click "Follow". All future updates on this story will be posted there.
Installing Bitbucket Cloud hooks
Installing Bitbucket Cloud hooks for local verification
The process is straight-forward:
- Create the commit policy. (It must be done once.)
- Ask all your developers to install the corresponding hook script to their local repositories. (It's a self-service process everyone can complete in minutes.)
That's it.
Bitbucket Cloud commits
In your daily developer workflow, when creating commits and pushing those to Bitbucket Cloud, you can use your Git client in the usual way. Looking from the client side, Bitbucket Cloud will be totally transparent for you: it will be "just a Git server".
See the Git commits section for detailed instructions.
Questions?
Ask us any time.