{"record":{"id":"e97dcf8b16bf1439","repo":"gitbutlerapp/gitbutler","slug":"not-in-a-git-repository","errorCode":null,"errorMessage":"Not in a Git repository","messagePattern":"Not in a Git repository","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/skill/mod.rs","lineNumber":534,"sourceCode":"        })\n    } else {\n        None\n    }\n}\n\n/// Get the base directory for installation (repo root or home directory)\nfn get_base_dir(ctx: Option<&mut Context>, global: bool) -> Result<PathBuf> {\n    if global {\n        home_dir().ok_or_else(|| anyhow::anyhow!(\"Could not determine home directory\"))\n    } else {\n        let ctx = ctx.ok_or_else(|| {\n            anyhow::anyhow!(\n                \"Not in a git repository. Use --global to install globally, or run from within a repository.\"\n            )\n        })?;\n        let repo = ctx.repo.get()?;\n        repo.workdir()\n            .ok_or_else(|| anyhow::anyhow!(\"Not in a Git repository\"))\n            .map(|p| p.to_path_buf())\n    }\n}\n\n/// Byte range of the frontmatter's closing `---` line plus the blank line\n/// after it, for any line ending (Unix, Windows, or old Mac). `None` unless\n/// the content opens with a frontmatter block, so a Markdown `---` rule in a\n/// document without one is never mistaken for the delimiter.\nfn frontmatter_close(content: &str) -> Option<std::ops::Range<usize>> {\n    if !(content.starts_with(\"---\\n\") || content.starts_with(\"---\\r\")) {\n        return None;\n    }\n    let after_opener = \"---\".len();\n    [\"---\\n\\n\", \"---\\r\\n\\r\\n\", \"---\\r\\r\"]\n        .into_iter()\n        .find_map(|delimiter| {\n            content[after_opener..]\n                .find(delimiter)","sourceCodeStart":516,"sourceCodeEnd":552,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/skill/mod.rs#L516-L552","documentation":"After obtaining the repository handle from the Context, local skill installation needs the working-directory path via `repo.workdir()`. This error is thrown when `workdir()` returns `None`, i.e., the resolved repository is bare and has no working tree in which to install skill files.","triggerScenarios":"Running `but skill install` inside a bare repository (e.g., a bare server-side clone), where the Context resolves to a repo whose `workdir()` is `None`.","commonSituations":"SSH-ing into a bare deployment repo and running the CLI there; pointing the tool at `.git` directly; CI setups that clone with `--bare`.","solutions":["Run the install from a normal (non-bare) clone of the repository.","Clone a working copy first (`git clone <url> repo && cd repo`) and install there.","Check `git rev-parse --is-bare-repository`; if true, switch to a worktree-equipped checkout."],"exampleFix":"// before\ncd /srv/repo.git && but skill install ./my-skill\n\n// after\ngit clone /srv/repo.git ~/repo && cd ~/repo && but skill install ./my-skill","handlingStrategy":"validation","validationCode":"let repo = ctx.repo.get()?;\nif repo.workdir().is_none() {\n    anyhow::bail!(\"repository is bare; skill install needs a working tree\");\n}","typeGuard":"fn is_bare(repo: &gix::Repository) -> bool { repo.workdir().is_none() }","tryCatchPattern":"match install(ctx, args) {\n    Err(e) if e.to_string() == \"Not in a Git repository\" =>\n        eprintln!(\"Use a non-bare clone for local skill install\"),\n    other => other?,\n}","preventionTips":["Check `git rev-parse --is-bare-repository` before local installs.","Clone a working copy instead of operating on bare repos.","Use `--global` when a working tree isn't available."],"tags":["git","bare-repository","workdir"],"backgroundTag":"unsupported-operation","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}