{"record":{"id":"8188a11b196e9cae","repo":"Graphify-Labs/graphify","slug":"git-hooks-path-from-source-looks-like-a-windows","errorCode":null,"errorMessage":"git hooks path from {source} looks like a Windows path: {value!r}. On WSL/POSIX this can't resolve to a real directory. Unset it with `git config --local --unset core.hooksPath`, or set a POSIX path.","messagePattern":"git hooks path from (.+?) looks like a Windows path: (.+?)\\. On WSL/POSIX this can't resolve to a real directory\\. Unset it with `git config --local --unset core\\.hooksPath`, or set a POSIX path\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"graphify/hooks.py","lineNumber":408,"sourceCode":"            return parent\n    return None\n\n\n_WINDOWS_DRIVE_RE = re.compile(r\"^[A-Za-z]:[\\\\/]\")\n\n\ndef _reject_windows_path(value: str, source: str) -> None:\n    \"\"\"Raise if a hooks path looks like a Windows absolute path (#1385).\n\n    On POSIX/WSL ``Path(\"C:\\\\Users\\\\...\").is_absolute()`` is False, so an absolute\n    Windows hooks path gets joined under the repo root and mkdir'd as a literal\n    junk directory (backslashes and all), while install reports success and the\n    real ``.git/hooks`` gets nothing. Fail loudly instead so the user can fix it.\n    \"\"\"\n    if os.name == \"nt\":\n        return\n    if _WINDOWS_DRIVE_RE.match(value) or \"\\\\\" in value:\n        raise RuntimeError(\n            f\"git hooks path from {source} looks like a Windows path: {value!r}. \"\n            f\"On WSL/POSIX this can't resolve to a real directory. Unset it with \"\n            f\"`git config --local --unset core.hooksPath`, or set a POSIX path.\"\n        )\n\n\ndef _hooks_dir(root: Path) -> Path:\n    \"\"\"Return the git hooks directory, respecting core.hooksPath if set (e.g. Husky).\n\n    Asks git itself via ``rev-parse --git-path hooks`` rather than parsing\n    ``.git/config`` with configparser: git legally allows duplicate keys and\n    sections (VS Code writes such configs), which a strict configparser rejects\n    with DuplicateOptionError/DuplicateSectionError, so every hook command\n    printed a spurious \"could not read core.hooksPath\" warning (#1907). git\n    resolves core.hooksPath, includeIf, and linked worktrees (where .git is a\n    file, not a directory) correctly in one place. Genuinely corrupt configs\n    are still surfaced: git itself fails on them, and its stderr is printed.\n    \"\"\"","sourceCodeStart":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/Graphify-Labs/graphify/blob/7fe58b0b0f3873be9a21c30106b8b8527c353aa6/graphify/hooks.py#L390-L426","documentation":"Raised by _reject_windows_path during hook install when core.hooksPath (from git config or equivalent source) contains a Windows-style path — a drive-letter prefix (C:\\...) or any backslash — on a POSIX system. The docstring explains the trap: Path('C:\\\\Users\\\\...').is_absolute() is False on Linux, so git would silently create a junk directory with literal backslashes inside the repo and report success while the real .git/hooks gets nothing; graphify fails loudly instead (regression guard #1385).","triggerScenarios":"Running `graphify hooks install` (or any path that resolves _hooks_dir) on Linux/WSL where core.hooksPath was copied from a Windows setup — e.g. a repo config shared from a Windows teammate, a dotfiles sync, or a WSL clone of a repo configured by Windows-side tooling (Husky etc.).","commonSituations":"Mixed Windows/WSL teams where .git/config or a global git config carries Windows paths; copying a repo including .git from Windows; CI on Linux after committing a Windows-local hooksPath.","solutions":["Unset the stale value: `git config --local --unset core.hooksPath` (use --global if it lives there)","Or set a POSIX path: `git config core.hooksPath .husky`","On WSL, verify with `git config --show-origin core.hooksPath` which file supplies the Windows path and fix that file","Re-run `graphify hooks install` afterwards"],"exampleFix":"# before\ngit config core.hooksPath   # C:\\Users\\me\\repo\\.husky\ngraphify hooks install       # RuntimeError: looks like a Windows path\n\n# after\ngit config --local --unset core.hooksPath\ngraphify hooks install","handlingStrategy":"validation","validationCode":"import re, subprocess\n\nWINDOWS_DRIVE = re.compile(r\"^[A-Za-z]:[\\\\/]\")\n\nraw = subprocess.run(\n    [\"git\", \"config\", \"--get\", \"core.hooksPath\"], capture_output=True, text=True\n).stdout.strip()\nif raw and (WINDOWS_DRIVE.match(raw) or \"\\\\\" in raw):\n    raise SystemExit(\n        f\"core.hooksPath {raw!r} is a Windows path on POSIX - \"\n        \"fix with: git config --local --unset core.hooksPath\"\n    )","typeGuard":null,"tryCatchPattern":"try:\n    install(Path(\".\"))\nexcept RuntimeError as e:\n    if \"looks like a Windows path\" in str(e):\n        subprocess.check_call([\"git\", \"config\", \"--local\", \"--unset\", \"core.hooksPath\"])\n        install(Path(\".\"))\n    else:\n        raise","preventionTips":["On WSL, check `git config --show-origin core.hooksPath` for Windows-sourced values after cloning","Never copy .git/config between Windows and POSIX machines","Use repo-relative POSIX hooksPath values (e.g. .husky) so they port across OSes"],"tags":["git","hooks","wsl","cross-platform","configuration"],"backgroundTag":null,"analyzedSha":"7fe58b0b0f3873be9a21c30106b8b8527c353aa6","analyzedAt":"2026-08-14T19:23:21.323Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}