{"record":{"id":"8f30542a7a108315","repo":"gitbutlerapp/gitbutler","slug":"cannot-check-local-installations-not-in-a-git-rep","errorCode":null,"errorMessage":"Cannot check local installations: not in a git repository.\nUse --global to check global installations, or run from within a repository.","messagePattern":"Cannot check local installations: not in a git repository\\.\nUse --global to check global installations, or run from within a repository\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/skill/mod.rs","lineNumber":828,"sourceCode":") -> Result<()> {\n    let t = theme::get();\n    // Determine scope\n    let (check_global, check_local) = match (global_only, local_only) {\n        (true, false) => (true, false),\n        (false, true) => (false, true),\n        (false, false) => (true, true), // default: check both\n        _ => unreachable!(),            // clap conflicts_with prevents this\n    };\n    // Only local installations live in a repository.\n    let mut ctx = if check_local {\n        repository_context(current_dir)?\n    } else {\n        None\n    };\n\n    // Warn if --local was explicitly requested but no repo context is available\n    if local_only && ctx.is_none() {\n        anyhow::bail!(\n            \"Cannot check local installations: not in a git repository.\\n\\\n             Use --global to check global installations, or run from within a repository.\"\n        );\n    }\n\n    // First check to find outdated skills (reborrow ctx so we can use it again later)\n    let initial_result = check_skill_status(ctx.as_mut(), check_global, check_local)?;\n\n    // Collect paths of outdated skills (needed for auto-update)\n    let outdated_paths: Vec<String> = initial_result\n        .skills\n        .iter()\n        .filter(|s| !s.up_to_date)\n        .map(|s| s.path.display().to_string())\n        .collect();\n\n    // Auto-update if requested (do this before displaying results)\n    if auto_update && !outdated_paths.is_empty() {","sourceCodeStart":810,"sourceCodeEnd":846,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/skill/mod.rs#L810-L846","documentation":"The `but skill check` command inspects skill installations locally and/or globally. With --local the check needs a git-repository context to resolve local skill directories; if --local was explicitly requested and no repository context (ctx) exists, the command bails explaining the limitation and suggesting --global or running inside a repository.","triggerScenarios":"Running `but skill check --local` outside any Git repository (no .git found up the tree) so no local repo context can be constructed.","commonSituations":"Running the command in a home directory, tmp folder, or non-project directory; typo'd --global flag so --local defaulted wrongly; CI jobs executing from a non-repo working directory.","solutions":["cd into a Git repository before running `but skill check --local`","Use `but skill check --global` when you only care about global installations","Drop the --local flag so the command checks only what context allows"],"exampleFix":"// before\nbut skill check --local   # run in ~/Downloads (not a repo)\n// after\ncd ~/code/my-project && but skill check --local","handlingStrategy":"validation","validationCode":"const inRepo = existsSync('.git') || findUpSync('.git') !== undefined;\nif (localFlag && !inRepo) { useGlobalOnly(); return; }","typeGuard":null,"tryCatchPattern":"try { execSync('but skill check --local'); } catch (e) { if (/not in a git repository/.test(e.message)) execSync('but skill check --global'); }","preventionTips":["Run skill commands from within a Git repository","Prefer --global when the working directory is unknown","Add a pre-flight repo check in scripts before using --local"],"tags":["cli","git","skills"],"backgroundTag":"missing-required-context","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"}