How to turn off the ability to delete pull requests in Bitbucket Data Center

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Bitbucket Data Center and Server versions 5.1.0 and later provide the ability to delete pull requests. This feature is enabled by default 

Users who can delete pull requests

By default, the following users can delete pull requests:

  • Pull request authors - authors can delete their own pull requests

  • Repository administrators - repository admins can delete anyone else's pull request within the repository they have admin access to

In case you want to disable the feature to delete pull requests, or change which permission is required to delete pull requests, please follow the steps below:

Solution

The configuration settings listed below are set in the <BITBUCKET-HOME>/shared/bitbucket.properties file. See Bitbucket config properties for more information.

Disable the feature to delete pull requests

To disable the feature to delete pull requests, add the following property:

1 feature.pull.request.deletion=false

Note that disabling this feature will prevent pull request deletion globally.

Change which permission is required to delete pull requests

To change which permission is required to delete the pull requests, set the following property:

1 2 3 4 5 # Determines which users can delete pull requests. # Valid values are: # - `AUTHOR` pull request authors and repository admins can delete pull requests # - `REPO_ADMIN` repository admins can delete pull requests pullrequest.deletion.role=REPO_ADMIN
  • If the property is set to AUTHOR, pull request authors and repository admins can delete pull requests. This is the default setting.

  • If the property is set to REPO_ADMIN, only repository admins can delete pull requests. Pull request authors will not be able to delete their pull requests.

Note: Please make sure that users to whom you would like to restrict from deleting the pull requests, do not have admin or system admin permissions globally under the Administration → Global Permissions section otherwise they should be able to delete the pull request.

Updated on February 14, 2025

Still need help?

The Atlassian Community is here for you.