Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root


1 badge earned


Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!


Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.


Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!


Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Create Git Commit Hook

Hi Community,

We are using BitBucket cloud service to host all our Git repositories.

I would like to enforce some rule on each commit for some repositories. Technically I want to apply a Git commit hook on server side to valid any incoming push and allow/reject it by a bunch of checks.

On BitBucket cloud I can only find the configuration of Webhooks. From the documentation I was not able to clarify my following questions:

  • The Webhook sends an HTTP POST request to remote server, is the response evaluated and has it impact on the incoming Git push? Or is it fire and forget?
  • Is it possible to achive commit hooks by using the Webhook functionality?


Thanks a lot, Roman


2 answers

1 accepted

1 vote
Answer accepted

I think I found the answer (

Git pre-commit hook is currently support in BitBucket DataCenter, but NOT in BitBucket Cloud.

BitBucket WebHooks are NOT an equivalent to that.

There is a ticket pending (might need more votes):


Regards, Roman

Everyone reading `this` please vote on

Hi Roman,

You can enable a webhook so every time you commit you can create a pull request, and manage a review of the code with that.

 You can make a Bitbucket REST API call (via curl or postman) to enable/disable specific hooks programmatically.

1. GET your repo hook keys via /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/hooks

2. PUT request for hook to be enabled  (DELETE disables the hook) via /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/settings/hooks/{hookKey}/enabled

Best Regards


Hi @laura.devita

thanks for you quick reply. Creating a PR on each commit is not exactly what I am looking for.

Actually I try to find a way on server side (BitBucket) to prevent a commit being  stored in BitBucket Git repository.

This can be useful for a couple reason. Mainly when you want to apply a quality gate that needs to be passed before a commit is accepted. E.g. developer should follow a certain code format rule or the commit message must contain some required information.

Apply this on all developer systems is a high effort and can of course be bypassed by the developers easily.

So it is a better approach to ensure those things on Git server side by what is called a commit hook.

It is also possible to apply these quality gates later on (thru a central CI instance) but it is much more charme to apply some check already when the commit is send and reject it if checks are failing.

Regards, Roman

Suggest an answer

Log in or Sign up to answer

Atlassian Community Events