This error occurs when Bitbucket's merge checks require a certain number of reviewer approvals before a pull request can be merged. You need to get the required approvals from team members or contact an admin to adjust the branch restrictions.
The error "Pull request needs minimum number of approvals before merging" means your Bitbucket repository has **merge checks** configured that enforce code review requirements. Before the pull request can be merged into the target branch, it must receive a specified minimum number of approvals from other team members. This is a branch protection feature designed to ensure code quality through peer review. Bitbucket allows repository admins to set various merge requirements including: - Minimum number of approvals (e.g., at least 2 reviewers must approve) - Approvals from specific default reviewers - No "changes requested" status from any reviewer - All tasks must be completed **Important**: In Bitbucket, the author of the pull request can approve their own PR, but that self-approval does **not** count towards the minimum approval requirement. You need approvals from other team members. This is a server-side enforcement that cannot be bypassed through Git commands alone—you must either get the required approvals or have an admin modify the merge check settings.
First, review your pull request to understand what approvals are needed:
1. Open the pull request in Bitbucket
2. Look at the reviewers section on the right sidebar
3. Note which reviewers have approved, are pending, or have requested changes
4. Check the merge checks section for specific requirements
# Example status you might see:
Reviewers:
✓ Alice (approved)
○ Bob (pending)
✗ Carol (changes requested)
Merge checks:
✗ Minimum 2 approvals (1/2 received)
✗ No changes requestedUnderstanding the indicators:
- ✓ (checkmark) = Approved
- ○ (circle) = Pending review
- ✗ (x) = Changes requested or check failed
You need to address all unresolved merge checks before merging.
If you need more approvals, actively request reviews:
In the Bitbucket UI:
1. Open your pull request
2. Click Add reviewer in the reviewers section
3. Select team members who can review your code
4. Click Add
Tips for getting faster reviews:
- Add a clear description explaining what changed and why
- Keep pull requests small and focused (easier to review)
- Mention specific reviewers in comments if urgent
- Link related issues or tickets for context
- Ensure CI builds are passing first
Using Bitbucket's Slack/Teams integration:
If your workspace has integrations enabled, reviewers will be notified automatically. You can also share the PR link directly with colleagues.
# Get the PR URL to share
# Format: https://bitbucket.org/{workspace}/{repo}/pull-requests/{id}Note: Self-approvals don't count. You cannot approve your own PR to meet the minimum requirement.
If a reviewer has requested changes, you must address their feedback:
1. Review the comments - Read through all inline comments and general feedback
2. Make the requested changes in your code
3. Push the updates to your branch
4. Respond to comments explaining how you addressed each concern
5. Request re-review from the reviewer who requested changes
# After making changes locally
git add .
git commit -m "Address review feedback: fix validation logic"
git push origin your-branch-nameImportant considerations:
- The reviewer who requested changes should update their review status
- On Premium plans, pushing new commits may reset all approvals (if "Reset approvals on change" is enabled)
- You may need to re-request approval from all reviewers after pushing changes
To request re-review:
1. In the PR, find the reviewer who requested changes
2. Click the "..." menu next to their name
3. Select "Request changes" or mention them in a comment
Your repository may have default reviewers who must approve separately from the minimum approval count:
Understanding default reviewers:
- Default reviewers are automatically added to PRs targeting specific branches
- Their approval may be required in addition to the minimum approval count
- Meeting minimum approvals alone won't allow merge if default reviewers haven't approved
To check default reviewer settings:
1. Go to Repository settings > Default reviewers
2. See which users or groups are set as default reviewers
3. Check if "Require approval from default reviewers" is enabled
Example scenario:
Settings:
- Minimum approvals: 2
- Default reviewers: Team Lead (required)
To merge, you need:
1. At least 2 approvals from any reviewers
2. PLUS an approval from Team Lead (even if they're one of the 2)If a required default reviewer is unavailable, contact your repository admin to temporarily adjust settings or assign an alternate.
To see exactly what merge checks are configured:
For Bitbucket Cloud:
1. Go to Repository settings > Branch restrictions
2. Find the branch pattern that matches your target branch (e.g., main or master)
3. Click to expand and view Merge checks settings
For Bitbucket Data Center/Server:
1. Go to Repository settings > Merge checks
2. View enabled checks and their requirements
3. Check if settings are inherited from project level
Common merge checks you might see:
- Minimum approvals - Number of required reviewer approvals
- All reviewers approve - Every assigned reviewer must approve
- Minimum successful builds - CI builds must pass
- No changes requested - No reviewer can have requested changes
- No incomplete tasks - All PR tasks must be resolved
Understanding inheritance:
Repository merge checks may inherit from project-level settings. Look for "Inherited from project" indicators in the settings.
If you cannot get the required approvals, contact your repository admin:
Legitimate reasons to request settings changes:
- Required reviewer is on leave or unavailable
- Emergency hotfix needs expedited review
- Minimum approval count is too high for team size
- Branch restrictions are incorrectly configured
What admins can do:
1. Temporarily reduce minimum approval requirements
2. Add/remove default reviewers
3. Override project-level inherited settings
4. Approve on behalf of unavailable team members (if permitted)
For Bitbucket Cloud Premium:
Admins can enable "Prevent merge with unresolved checks" which strictly enforces all requirements. Without Premium, merge checks are warnings only.
For Bitbucket Data Center:
Admins can configure at project or repository level:
Repository settings > Merge checks > More actions >
- Inherit from project
- Enable (override project)
- Disable (override project)Note: Always document why you're requesting an exception and get proper authorization for emergency changes.
If automated workflows are blocked by approval requirements:
For CI/CD pipelines trying to merge:
Ensure your pipeline waits for manual approvals before attempting merge:
# bitbucket-pipelines.yml example
pipelines:
pull-requests:
'**':
- step:
name: Build and Test
script:
- npm install
- npm test
# Don't auto-merge - let humans approve firstUsing the Bitbucket API:
Check approval status before attempting merge:
# Check PR status via API
curl -u username:app_password \
"https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/pullrequests/{id}"
# The response includes:
# - "participants" with approval status
# - "state" of the PRFor automated bots (Renovate, Dependabot):
Configure bots to wait for human approval:
// renovate.json
{
"automerge": false,
"prCreation": "immediate",
"reviewers": ["team:code-reviewers"]
}Merge trains (Premium):
Ensure approvals are obtained before PRs enter the merge queue. The queue respects all merge checks.
Set up processes to streamline code review:
1. Configure appropriate team size for approvals:
Recommended settings by team size:
- 2-3 developers: 1 approval minimum
- 4-6 developers: 2 approvals minimum
- 7+ developers: 2-3 approvals minimum2. Use code owners (via apps like Code Owners for Bitbucket):
Automatically assign reviewers based on file paths changed.
3. Enable helpful notifications:
- Integrate with Slack/Teams for review requests
- Set up email notifications for PR assignments
- Use Bitbucket's "watching" feature
4. Establish review SLAs:
Document expected review turnaround times for your team.
5. Consider approval preservation (Premium):
Enable "Keep approvals if there are no changes to diff" to prevent re-review cycles when rebasing.
6. Create review checklists:
Add PR templates with review criteria:
## PR Checklist
- [ ] Tests added/updated
- [ ] Documentation updated
- [ ] No security vulnerabilities
- [ ] Code follows style guidelinesThis helps reviewers approve faster with confidence.
### Bitbucket Cloud vs Data Center/Server
Bitbucket Cloud:
- Merge checks configured in Repository settings > Branch restrictions
- Premium plan required to strictly enforce checks (otherwise they're warnings only)
- "Reset approvals on change" is Premium-only
- "Preserve approvals for unchanged diffs" is Premium-only
Bitbucket Data Center/Server:
- Merge checks in Repository settings > Merge checks
- Settings can inherit from project level
- Starting v8.10, project admins can restrict repository-level customization
- All merge check features available without separate licensing
### API Operations
Check PR approval status:
curl -u username:app_password \
"https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/pullrequests/{id}"List reviewers and their status:
curl -u username:app_password \
"https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/pullrequests/{id}/participants"Approve a PR via API:
curl -X POST -u username:app_password \
"https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/pullrequests/{id}/approve"Merge a PR (will fail if checks not met):
curl -X POST -u username:app_password \
"https://api.bitbucket.org/2.0/repositories/{workspace}/{repo}/pullrequests/{id}/merge"### Branch Permission Hierarchy
1. Workspace-level - Applies to all repositories in workspace
2. Project-level - Applies to all repositories in project
3. Repository-level - Specific to one repository
More specific settings override broader ones, unless project admins have locked settings.
### Merge Strategies and Approvals
Different merge strategies don't affect approval requirements:
- Merge commit - Standard merge, requires approvals
- Squash - Combines commits, requires approvals
- Fast-forward - Linear history, requires approvals
All strategies respect the same merge check requirements.
### Default Reviewers vs Minimum Approvals
These are separate requirements:
Scenario:
- Minimum approvals: 2
- Default reviewer: Alice (required)
- Default reviewer: Bob (not required)
Case 1: Carol and Dave approve
Result: ✗ Cannot merge (Alice hasn't approved)
Case 2: Alice and Carol approve
Result: ✓ Can merge (2 approvals + Alice approved)
Case 3: Alice, Bob, Carol approve
Result: ✓ Can merge (exceeds requirements)### Approval Reset Behavior (Premium)
When "Reset approvals on change" is enabled:
- Any new commit to the source branch clears all approvals
- Reviewers must re-approve after each change
- Helpful for ensuring reviewers see final code
- Can slow down iteration-heavy development
When "Preserve approvals for unchanged diffs" is enabled:
- Approvals persist if the actual diff hasn't changed
- Rebasing or empty commits don't reset approvals
- Useful for keeping approvals after syncing with main branch
### Troubleshooting Stuck PRs
Approval count seems wrong:
- Self-approvals don't count toward minimum
- Check if required default reviewers have approved
- Verify no "changes requested" status exists
Merge button still disabled after approvals:
- Check for other merge checks (builds, tasks)
- Verify all default reviewers have approved
- Look for branch permission issues
API merge fails despite UI showing ready:
- Ensure API user has merge permission
- Check for race conditions with approval resets
- Verify authentication token has correct scopes
warning: BOM detected in file, this may cause issues
UTF-8 Byte Order Mark (BOM) detected in file
fatal: Server does not support --shallow-exclude
Server does not support --shallow-exclude
warning: filtering out blobs larger than limit
Git partial clone filtering large blobs warning
fatal: Server does not support --shallow-since
Server does not support --shallow-since in Git
kex_exchange_identification: Connection closed by remote host
Connection closed by remote host when connecting to Git server