In Bitbucket Cloud, how would you make one project enforce main protection, two approvals and a merge strategy across forty migrated repositories?
answer
- set it once, one level up
- what reaches existing repositories
- the inherit switch
- transfers arrive with no access
- enforcement needs a plan
basics
~20 sDefine it once on the Bitbucket Cloud project: permissions, a main branch restriction with merge checks, default reviewers and a merge strategy. Permissions and restrictions reach every repository; moved repositories must be switched to inherit the merge strategy.
solid answer
~50 sMake the **project** the unit of policy. Grant the team's group **Write** on the project, so every repository in it, old and new, inherits access. Add a **project branch restriction** on `main`: write access for a small maintainer group, merge access via pull requests for developers, and merge checks for at least two approvals, successful builds and resolved tasks; these restrictions are enforced on every repository in the project. Blocking rather than warning needs **Premium** and *Prevent a merge with unresolved merge checks*. Add **project default reviewers** and a **project default merge strategy**, but switch each repository moved into the project to **inherit** the project's settings, since repositories added to an existing project do not pick up its defaults on their own. Finally, audit leftovers: repositories transferred from another workspace arrive with no access list, and individual repository grants survive any project change.
go deeper
Recall that a project can hold permissions, branch restrictions, default reviewers and a default merge strategy for all of its repositories.
Explain which project settings reach existing repositories directly and which need the repository switched to inherit them.
Plan the migration end to end: transfers with empty access lists, the inherit switch, Premium enforcement, and an audit of leftover repository-level grants and rules.
Decide what is project policy versus workspace-wide custom checks, and how much exception handling repository admins should keep.
## Why the project is the unit Forty repositories configured one by one drift apart within a month. Bitbucket Cloud gives you a level above the repository for exactly this: the **project**. A project groups repositories inside one workspace and carries settings that apply to all of them — permissions, branch restrictions, default reviewers, the branching model and a default merge strategy. The design goal is that a new repository dropped into the project is governed without anyone touching its settings, and the old ones are brought into line once. The catch is that not every project setting reaches existing repositories the same way. Knowing which ones do is the senior part of the answer. ## Moving the repositories in 1. **Transfer or create** the repositories in the target workspace. A repository transferred from another workspace **loses all its access groups** and does not inherit the destination's default access groups, so it arrives with access to grant. 2. **Assign each repository to the project** through its Project field. Moving a repository between projects of one workspace keeps its URL. 3. **Switch each moved repository to inherit the project's settings.** Atlassian's note is explicit for the merge strategy: repositories added to a project must be told to inherit the project-level settings. 4. **Connect the workspace to Jira once**, so keys in branch names, commits and pull request titles link everywhere; smart commits are enabled by default for new repositories in the linked account. ## The project settings that do the enforcing | Setting | What to set | Reaches repositories already in the project? | Plan | |---|---|---|---| | **Project permissions** | Developers group **Write**; a few leads **Admin** | Yes, old and new; repository admins cannot edit them | Any | | **Project branch restriction on `main`** | Write access: maintainers; Merge access via pull requests: developers | Yes, enforced on every repository in the project | Any | | **Merge checks in that restriction** | Minimum 2 approvals, successful builds on the last commit, no unresolved tasks | Yes, as warnings | Any | | **Prevent a merge with unresolved merge checks** | Selected | Turns those warnings into a block | Premium | | **Reset approvals when the source branch is modified** | Selected, with *Keep approvals if there is no change to the diff* | Yes | Premium | | **Default reviewers** | The team's reviewers | Added to pull requests unless the repository's own settings say otherwise | Any | | **Default merge strategy** | For example *Squash* or *Rebase, fast-forward* | Repositories created in the project pick it up; ones added to it must be switched to inherit | Any | ## What still leaks Even with every project setting in place, access and policy can come from somewhere else: - **Individual repository grants.** Removing a user from the project does not remove permissions granted directly on a repository or through a workspace group. - **Repository-level restrictions.** A repository can carry its own restriction on `main`; where two matching restrictions both name users, their lists combine, so a leftover rule can widen who may push. - **Group defaults.** Editing a workspace group's default repository access affects future repositories only. - **Plan.** On Standard, the two-approval rule is visible on every pull request but does not block anything. - **Workspace admins.** *Administer workspace* reaches the settings of every repository; keep that group small. ## Verifying 1. Open a repository that was moved in and confirm it shows the project's permissions as inherited, and its merge strategy as inherited from the project. 2. As a developer with only merge access, try pushing to `main`; it should be refused. 3. Open a pull request with one approval and confirm the merge is blocked, not just warned, on Premium. 4. List users with repository-level grants and remove the ones the project already covers. ## Workspace-wide checks If a rule must hold in every project, not just this one, **custom merge checks** are the tool: apps a workspace admin installs and enables. On Premium a check can be marked `required` at workspace, project or repository level, and a check required higher up cannot be disabled lower down. Atlassian documents the built-in branch restrictions on projects and repositories, so a rule you want everywhere either goes into each project or becomes a required custom check. Build configuration that produces the successful builds these checks count is a separate subject; here, all that matters is that the status lands on the pull request's last commit.
- After the move, one Bitbucket Cloud repository still lets a contractor push to main. Where do you look?Look at that repository's own branch restrictions: a leftover rule on main or a pattern that names the contractor can combine with the project's list. Then check repository permissions and workspace groups, because grants there survive project changes. Remove the repository-level rule rather than editing the project's.
- How do you make a custom ticket-format check mandatory in every Bitbucket Cloud project?Install and enable a custom merge check app at workspace level, then on Premium mark the check required in workspace settings. A check required at workspace level runs on matching pull requests in every project and repository and cannot be disabled lower down.
- Transferring a repository into the workspace carries its user and group permissions along.
- A project default merge strategy updates repositories that were moved in earlier.
- Project branch restrictions apply only to repositories created after the restriction.
- A repository admin can loosen the project's permissions on their own repository.
- Merge checks set on a project block merges on every Bitbucket plan.