This error occurs when you try to merge or push to a protected branch on GitHub, but one or more required CI/CD status checks have not passed. GitHub blocks the merge until all configured status checks report success.
When GitHub rejects your push with the GH006 error mentioning "required status check is failing," it means the branch protection rules require specific CI/CD checks to pass before any code can be merged or pushed. This is separate from other GH006 errors about pull request requirements. GitHub's required status checks feature integrates with CI/CD systems to ensure code quality: - **CI pipelines** (GitHub Actions, Jenkins, CircleCI, Travis CI) must complete successfully - **Code quality tools** (linters, formatters, security scanners) must report passing status - **External services** (Codecov, SonarCloud, required reviewers via apps) must approve The error occurs because: 1. A required status check is reporting "failure" or "error" 2. A required status check never ran (shows as "pending" indefinitely) 3. The status check name in your CI config doesn't match what branch protection expects 4. A previously passing check is now stale and needs to be re-run This protection prevents broken or untested code from reaching your main branches, but can be frustrating when checks fail unexpectedly or are misconfigured.
First, identify exactly which checks are blocking the merge:
1. Go to your pull request on GitHub
2. Scroll to the "Checks" section at the bottom
3. Look for checks marked with a red X (failed) or yellow dot (pending)
4. Click on the failing check to see detailed logs
You can also check via the GitHub CLI:
# List all status checks for a PR
gh pr checks <PR_NUMBER>
# View detailed status
gh pr view <PR_NUMBER> --json statusCheckRollupIf a check shows "Expected" but never appears, the workflow isn't running at all.
If your CI pipeline is genuinely failing, fix the underlying issue:
For test failures:
# Run tests locally to reproduce
npm test
# or
pytest
# or
go test ./...For linting/formatting failures:
# Fix linting issues
npm run lint -- --fix
# or
black .
# or
go fmt ./...For build failures:
# Check build locally
npm run build
# or
cargo buildCommit the fixes and push to re-trigger the checks.
A common issue is mismatched check names. GitHub requires an exact match.
Find the actual check name:
1. Go to any recent PR where checks ran
2. Note the exact name shown (e.g., "build (ubuntu-latest)")
3. Names are case-sensitive and include matrix variables
Compare with branch protection settings:
1. Go to Settings > Branches > Edit your protection rule
2. Under "Require status checks to pass", see what's listed
3. The names must match exactly
For GitHub Actions, the check name comes from:
jobs:
build: # This becomes part of the check name
name: "Build and Test" # If specified, this overrides job ID
runs-on: ubuntu-latest
# Full check name might be: "Build and Test" or "build (ubuntu-latest)"If names don't match, either:
- Update the workflow to produce the expected name
- Update branch protection to require the actual check name
If status checks show as "Expected" but never run, the workflow isn't triggering:
Check workflow triggers in your CI config:
# .github/workflows/ci.yml
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop] # Must include your target branchCommon trigger issues:
- Workflow only triggers on push but you need it on pull_request
- Branch pattern doesn't match (e.g., main vs master)
- Path filters exclude your changed files
- Workflow was added to a branch that doesn't exist in the PR's base
For external CI systems (Jenkins, CircleCI):
- Verify webhooks are configured in repo Settings > Webhooks
- Check the external system is receiving events
- Ensure the commit SHA matches what GitHub expects
Sometimes checks from previous commits become stale or stuck:
Re-run from the GitHub UI:
1. Go to the pull request
2. Click on the failing/stuck check
3. Click "Re-run jobs" or "Re-run all jobs"
Re-run via GitHub CLI:
# Re-run failed checks
gh run rerun <RUN_ID> --failed
# List recent workflow runs to find the ID
gh run list --branch <your-branch>Force a new commit to trigger fresh checks:
# Empty commit to re-trigger CI
git commit --allow-empty -m "chore: trigger CI"
git pushSync with base branch:
# Update from main to get fresh check context
git fetch origin main
git merge origin/main
git pushIf using external services like Codecov, SonarCloud, or review apps:
Check service status:
- Visit the service's status page (e.g., status.codecov.io)
- Verify API tokens haven't expired
- Check the service is properly integrated with your repo
For Codecov issues:
# Ensure coverage is uploaded in CI
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
fail_ci_if_error: true # Makes failures visibleFor SonarCloud issues:
- Check project configuration at sonarcloud.io
- Verify the project key matches your repo
- Ensure quality gate conditions are reasonable
If the service is down, you may need to:
1. Wait for it to recover
2. Temporarily remove it from required checks (if you have admin access)
3. Contact the service's support
If a required check no longer exists (renamed workflow, removed CI system):
Remove from branch protection:
1. Go to Settings > Branches > Edit protection rule
2. Under "Require status checks to pass"
3. Click the X next to outdated check names
4. Add the new/correct check names
5. Save changes
Using GitHub Rulesets (recommended for organizations):
1. Go to Settings > Rules > Rulesets
2. Edit the relevant ruleset
3. Update "Require status checks to pass" with correct names
4. Rulesets can apply across multiple repos consistently
Via GitHub API:
# List current required checks
gh api repos/{owner}/{repo}/branches/main/protection/required_status_checks
# Update required checks
gh api repos/{owner}/{repo}/branches/main/protection/required_status_checks \
-X PATCH \
-f contexts[]="build" \
-f contexts[]="test"If automation needs to push despite failing checks (use sparingly):
Allow specific actors to bypass:
1. Go to Settings > Branches > Edit protection rule
2. Enable "Allow specified actors to bypass required pull requests"
3. Add the automation user or app
4. This also bypasses status check requirements
For GitHub Actions with elevated permissions:
# Use a PAT instead of GITHUB_TOKEN
- uses: actions/checkout@v4
with:
token: ${{ secrets.BYPASS_TOKEN }}Warning: Bypassing status checks defeats their purpose. Only use for:
- Hotfix scenarios with proper oversight
- Automated releases that have already passed checks elsewhere
- Administrative corrections
Never bypass checks for regular development work.
### Understanding Status Check States
GitHub status checks have several states:
- success: Check passed (green checkmark)
- failure: Check failed (red X)
- error: Check encountered an error (red X)
- pending: Check is running (yellow dot)
- expected: Check is required but hasn't reported yet (gray dot)
The "expected" state often causes confusion - it means GitHub is waiting for a check that never arrives.
### Matrix Builds and Check Names
When using matrix strategies in GitHub Actions, each combination creates a separate check:
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node: [18, 20]
runs-on: ${{ matrix.os }}This creates four separate checks:
- test (ubuntu-latest, 18)
- test (ubuntu-latest, 20)
- test (windows-latest, 18)
- test (windows-latest, 20)
You need to require all of them, or use a separate aggregating job.
### Aggregating Multiple Checks
Instead of requiring many individual checks, create an aggregating job:
jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- run: npm test
# Single check to require
all-tests-pass:
needs: test
runs-on: ubuntu-latest
steps:
- run: echo "All tests passed"Then only require all-tests-pass in branch protection.
### Status Check Contexts vs GitHub Actions
GitHub has two status check systems:
1. Commit Status API: External services set status via API
2. Check Runs API: GitHub Actions and GitHub Apps use this
Both can be required in branch protection. The names work differently:
- Commit Status: You define the context string
- Check Runs: Name derived from workflow and job configuration
### Required Checks in Forks
For public repos, required checks on PRs from forks have limitations:
- First-time contributors need approval to run workflows
- Fork PRs don't have access to repo secrets
- Some checks may fail or not run due to these restrictions
Consider using pull_request_target carefully or having maintainers trigger checks manually.
kex_exchange_identification: Connection closed by remote host
Connection closed by remote host when connecting to Git server
fatal: unable to access: Proxy auto-configuration failed
How to fix 'Proxy auto-configuration failed' in Git
fatal: unable to access: Authentication failed (proxy requires basic auth)
How to fix 'Authentication failed (proxy requires basic auth)' in Git
fatal: unable to access: no_proxy configuration not working
How to fix 'no_proxy configuration not working' in Git
fatal: unable to read tree object in treeless clone
How to fix 'unable to read tree object in treeless clone' in Git