# Ensure force pushes are not allowed on the default branch

- Source: https://support.icompaas.com/support/solutions/articles/a_1789072805072156-ensure-force-pushes-are-not-allowed-on-the-default-branch
- Section: [Solutions](https://support.icompaas.com/support/solutions) › [Version Control System (VCS)](https://support.icompaas.com/support/solutions/c_1781179095087930) › [Bitbucket](https://support.icompaas.com/support/solutions/folders/f_1781179159125832)
- Last updated: 2026-10-26
- Publisher: iCompaas, Inc. (https://www.icompaas.com)

Description

This check verifies that force pushes are restricted on the default branch of a Bitbucket repository. Branch restrictions help protect critical branches by preventing users from rewriting branch history through force push operations, ensuring that committed code changes remain traceable and repository history is preserved.  
  
Note: Only repository-level branch restrictions are detected. Restrictions set only at the project level are not returned by Bitbucket’s API and will result in a FAIL. Configure the restriction at the repository level for accurate results.

Rationale

The default branch typically contains stable or production-ready code. Allowing force pushes on the default branch enables users to overwrite existing commits, remove commit history, or bypass established review processes. This can result in loss of important changes, difficulty tracking modifications, and reduced confidence in repository history. Disabling force pushes on the default branch helps maintain commit integrity, ensures traceability of changes, and reduces the risk of unauthorized or accidental history rewrites.

Impact

-   Prevent users from rewriting or removing existing commit history.
    
-   Protect the integrity and traceability of repository changes.
    
-   Reduce the risk of accidental loss of commits.
    
-   Ensure that changes follow the organization's review and approval process.
    
-   Require administrators to follow controlled procedures when history modifications are necessary.
    

Default Value

Depends on repository configuration. Bitbucket repositories do not automatically prevent force pushes on branches. Repository administrators must manually configure branch restrictions to disable force pushes on the default branch.

Pre-Requisites

-   Repository administrator access
    
-   An existing Bitbucket repository
    

Test Plan

1.  Sign in to Bitbucket at [https://bitbucket.org](https://bitbucket.org/).
    
2.  Navigate to the target repository.
    
3.  Select Repository settings.
    
4.  Under the Workflow section, select Branch restrictions.
    
5.  Review the configured branch restriction rules.
    
6.  Verify that a restriction exists for the default branch preventing force pushes.
    
7.  If force push protection is not enabled for the default branch (typically main or master), follow the implementation steps.
    

Implementation Steps

1.  Sign in to Bitbucket at [https://bitbucket.org](https://bitbucket.org/).
    
2.  Navigate to the target repository.
    
3.  Select Repository settings.
    

4.  Under the Workflow section, select Branch restrictions.
    

5.  Click Add a branch restriction.
    
6.  Select By branch name or pattern and enter the default branch name (for example, main).
    

7.  Configure the branch restriction to prevent rewriting branch history.
    
8.  Ensure the option Allow rewriting branch history remains unchecked.
    

9.  Configure additional branch permissions according to organizational requirements.
    
10.  Save the changes.
     

Backout Plan

1.  Sign in to Bitbucket at [https://bitbucket.org](https://bitbucket.org/).
    
2.  Navigate to the target repository.
    
3.  Select Repository settings.
    
4.  Under the Workflow section, select Branch restrictions.
    
5.  Locate the branch restriction rule configured to prevent force pushes on the default branch.
    
6.  Click Remove to delete the branch restriction rule.
    

7.  Confirm that repository operations function as expected after the rollback.
    

Reference

-   [https://support.atlassian.com/bitbucket-cloud/docs/use-branch-permissions/](https://support.atlassian.com/bitbucket-cloud/docs/use-branch-permissions/)
    
-   [https://support.atlassian.com/bitbucket-cloud/docs/use-branch-permissions/](https://support.atlassian.com/bitbucket-cloud/docs/use-branch-permissions/)
    
-   [https://support.atlassian.com/bitbucket-cloud/docs/work-with-pull-requests/](https://support.atlassian.com/bitbucket-cloud/docs/work-with-pull-requests/)

## Related compliance guidance

- [SOC 2 compliance: a practical implementation guide for cloud-native SaaS teams](https://support.icompaas.com/compliance/soc-2-trust-services-criteria): Configuration checks like this one are the technical half of a SOC 2 / ISO 27001 programme — the guide shows where they fit, what else an auditor expects, and how to evidence them.
- [ISO/IEC 27001:2022 compliance: a practical implementation guide](https://support.icompaas.com/compliance/iso-27001-2022): ISO 27001 Annex A.8 (technological controls) is where cloud hardening evidence lands; the guide shows how to run the ISMS around it.
