This article explains how to enable a hook in a Bitbucket repository using Command Line Interface (CLI)
Using the action enableHook, a pre-receive or post-receive hook can be enabled from a Bitbucket repository.
--action enableHook --project "PROJ" --repository "repo-1" --hook "Reject Force Push"
In this CLI action,
- To check the status of the hook, navigate to Repositories > Repository settings > Hooks. The hook is enabled as shown in the screenshot below:
It is recommended to test this scenario in a non-production environment or run the action with the --simulate parameter to verify the behavior before deploying.