{"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":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/but/src/command/skill/mod.rs","lineNumber":422,"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/// Replace version in SKILL.md content\nfn inject_version(content: &str, version: &str) -> String {\n    // Handle different line endings (Unix \\n, Windows \\r\\n, or old Mac \\r)\n    let frontmatter_end = content\n        .find(\"---\\n\\n\")\n        .or_else(|| content.find(\"---\\r\\n\\r\\n\"))\n        .or_else(|| content.find(\"---\\r\\r\"));\n\n    if let Some(end_pos) = frontmatter_end {\n        let frontmatter = &content[..end_pos];\n        let rest = &content[end_pos..];\n        let updated_frontmatter =\n            frontmatter.replace(\"version: 0.0.0\", &format!(\"version: {version}\"));\n        format!(\"{updated_frontmatter}{rest}\")","sourceCodeStart":404,"sourceCodeEnd":440,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/skill/mod.rs#L404-L440","documentation":"Even when a repository is discovered, skill install needs a working tree to place files in (repo.workdir()). Bare repositories have none, so this error distinguishes 'found a repo, but it is bare' from the no-repository case handled just above.","triggerScenarios":"`but skill install <skill>` (no --global) from inside a bare clone created with `git clone --bare`, a server-side repository, or accidentally from inside a .git directory.","commonSituations":"Automation against bare origin repos on a server; cd-ing into .git and running but there.","solutions":["Run the command from a non-bare checkout of the repository","Or use --global to install into the home directory","Verify `git rev-parse --is-bare-repository` prints false before running"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let repo = ctx.repo.get()?;\nif repo.workdir().is_none() {\n    anyhow::bail!(\"repository is bare; install skills from a checkout or use --global\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Confirm `git rev-parse --is-bare-repository` prints false before installing","Keep a non-bare checkout alongside bare central repos"],"tags":["skill","install","bare-repository","workdir"],"backgroundTag":"bare-repository-no-worktree","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}