Restrict repository settings changes in Bitbucket
Bitbucket offers a project-level setting to control changes to repository settings. You can manage this using the Bitbucket CLI. Here’s how to do it.
Settings options
Allow repository admins to manage permissions.
This is the default setting and allows repository administrators to modify permissions.Don’t allow repository admins to manage permissions.
This setting restricts repository administrators from modifying permissions.
To set restrictions on repository settings using the command-line interface, follow these steps:
Allow repository admins to manage permissions:
acli mybitbucket -a renderRequest --project EXPERIMENT --requestType DELETE --url "/rest/api/latest/projects/@project@/settings-restriction?namespace=com.atlassian.bitbucket.server%3Ainternal&featureKey=repository-permissions" --type json
Restrict repository admins from managing permissions:
acli mybitbucket -a renderRequest --project EXPERIMENT --requestType POST --url /rest/api/latest/projects/@project@/settings-restriction --type json --data '{"namespace":"com.atlassian.bitbucket.server:internal","featureKey":"repository-permissions"}'
Command Adjustments
For Bitbucket versions 8.17.x and 8.18.x, the provided commands should work as is.
For versions 8.8 to 8.16, if you encounter Resource does not exist error messages, change
api
toui
in the URLs.
Example commands for versions 8.8 to 8.16:
Allow
acli mybitbucket -a renderRequest --project EXPERIMENT --requestType DELETE --url "/rest/ui/latest/projects/@project@/settings-restriction?namespace=com.atlassian.bitbucket.server%3Ainternal&featureKey=repository-permissions" --type json
Restrict