{
  "id": "git/detached-head-from-bare-repo",
  "signature": "fatal: This operation must be run in a work tree",
  "signature_zh": "致命错误：此操作必须在工作树中运行",
  "regex": "fatal:\\s+This\\s+operation\\s+must\\s+be\\s+run\\s+in\\s+a\\s+work\\s+tree",
  "domain": "git",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Attempting to run a command that requires a working tree (like checkout or status) inside a bare repository.",
  "root_cause_type": "generic",
  "root_cause_zh": "尝试在裸仓库中运行需要工作树的命令（如checkout或status）",
  "versions": [
    {
      "version": "git 2.43.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "git 2.44.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "git 2.45.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Running 'git checkout main' in a bare repo thinking it will switch branches",
      "why_fails": "Bare repos have no working tree; checkout cannot modify files",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Setting GIT_DIR to a bare repo path and running git status",
      "why_fails": "Bare repos store only objects, no index or working tree for status",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Clone the bare repo into a working tree: git clone /path/to/bare.git /tmp/workdir && cd /tmp/workdir && git status",
      "success_rate": 0.95,
      "how": "Clone the bare repo into a working tree: git clone /path/to/bare.git /tmp/workdir && cd /tmp/workdir && git status",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use 'git worktree add' to create a linked working tree from the bare repo: git worktree add /tmp/workdir main",
      "success_rate": 0.85,
      "how": "Use 'git worktree add' to create a linked working tree from the bare repo: git worktree add /tmp/workdir main",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Clone the bare repo into a working tree: git clone /path/to/bare.git /tmp/workdir && cd /tmp/workdir && git status",
    "Use 'git worktree add' to create a linked working tree from the bare repo: git worktree add /tmp/workdir main"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://git-scm.com/docs/git-worktree",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-02-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}