gitbutlerapp/gitbutler · error
Cannot check local installations: not in a git…
Error message
Cannot check local installations: not in a git repository. Use --global to check global installations, or run from within a repository.
What it means
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.
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
Example fix
// before but skill check --local # run in ~/Downloads (not a repo) // after cd ~/code/my-project && but skill check --local
Defensive patterns
Strategy: validation
Validate before calling
const inRepo = existsSync('.git') || findUpSync('.git') !== undefined;
if (localFlag && !inRepo) { useGlobalOnly(); return; } Try / catch
try { execSync('but skill check --local'); } catch (e) { if (/not in a git repository/.test(e.message)) execSync('but skill check --global'); } Prevention
- 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
When it happens
Trigger: Running `but skill check --local` outside any Git repository (no .git found up the tree) so no local repo context can be constructed.
Common situations: 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.
Related errors
- Aborting due to empty branch name
- Bare repositories are not supported.
- Branch ' ' not found
- Branch ' ' not found when checking for conflicts
- Branch " " has no conflicted commits.
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/8f30542a7a108315.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but/src/command/skill/mod.rs:828
) -> Result<()> {
let t = theme::get();
// Determine scope
let (check_global, check_local) = match (global_only, local_only) {
(true, false) => (true, false),
(false, true) => (false, true),
(false, false) => (true, true), // default: check both
_ => unreachable!(), // clap conflicts_with prevents this
};
// Only local installations live in a repository.
let mut ctx = if check_local {
repository_context(current_dir)?
} else {
None
};
// Warn if --local was explicitly requested but no repo context is available
if local_only && ctx.is_none() {
anyhow::bail!(
"Cannot check local installations: not in a git repository.\n\
Use --global to check global installations, or run from within a repository."
);
}
// First check to find outdated skills (reborrow ctx so we can use it again later)
let initial_result = check_skill_status(ctx.as_mut(), check_global, check_local)?;
// Collect paths of outdated skills (needed for auto-update)
let outdated_paths: Vec<String> = initial_result
.skills
.iter()
.filter(|s| !s.up_to_date)
.map(|s| s.path.display().to_string())
.collect();
// Auto-update if requested (do this before displaying results)
if auto_update && !outdated_paths.is_empty() {View on GitHub (pinned to 58e5313667)