{
  "id": "git/remote-rejected-branch-protection",
  "signature": "remote: error: GH006: Push to protected branch 'main' is not allowed.",
  "signature_zh": "远程：错误：GH006：不允许推送到受保护分支 'main'。",
  "regex": "remote: error: GH006: Push to protected branch '.*' is not allowed\\.",
  "domain": "git",
  "category": "auth_error",
  "subcategory": null,
  "root_cause": "The remote repository (e.g., GitHub) has branch protection rules that prevent direct pushes to certain branches like 'main'.",
  "root_cause_type": "generic",
  "root_cause_zh": "远程仓库（例如 GitHub）具有分支保护规则，阻止直接推送到某些分支（如 'main'）。",
  "versions": [
    {
      "version": "git 2.30.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "git 2.37.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "git 2.43.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Branch protection rules on the server still reject force pushes; may also cause security alerts.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Authentication is not the issue; the server enforces the rule regardless of credentials.",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Does not affect the remote branch protection; push still fails.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Create a new branch and push there: git checkout -b feature-branch && git push origin feature-branch, then open a pull request.",
      "success_rate": 0.95,
      "how": "Create a new branch and push there: git checkout -b feature-branch && git push origin feature-branch, then open a pull request.",
      "condition": "",
      "sources": []
    },
    {
      "action": "If you have admin rights, temporarily disable branch protection in the repository settings, push, then re-enable.",
      "success_rate": 0.8,
      "how": "If you have admin rights, temporarily disable branch protection in the repository settings, push, then re-enable.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use 'git push origin main:refs/heads/main' but only if you have bypass permissions; otherwise, use pull requests.",
      "success_rate": 0.7,
      "how": "Use 'git push origin main:refs/heads/main' but only if you have bypass permissions; otherwise, use pull requests.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Create a new branch and push there: git checkout -b feature-branch && git push origin feature-branch, then open a pull request.",
    "If you have admin rights, temporarily disable branch protection in the repository settings, push, then re-enable.",
    "Use 'git push origin main:refs/heads/main' but only if you have bypass permissions; otherwise, use pull requests."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches",
  "official_doc_section": null,
  "error_code": "GH006",
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-02-14",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}