jdx/mise · error

cannot check staged changes: git is unavailable

Error message

cannot check staged changes: git is unavailable

What it means

Before applying a pull, staged_paths asks git (the plumbing binary resolved by crate::git::plumbing_binary) which paths in the work tree are staged, so it can skip or handle them. If no git binary can be located on the system, mise cannot even check for staged changes and bails with this error instead of guessing. The pull is aborted because applying history over unknown staged state could destroy user work.

Solutions

  1. Install git (e.g. `apt install git`, `brew install git`) or fix PATH so the git binary is findable.
  2. Verify with `which git` / `git --version` in the same shell that runs mise.
  3. If mise is configured with a custom git binary path, correct or remove that configuration.
  4. Commit or note your staged changes manually, then retry the sync once git is available.

Example fix

// before
$ mise dot sync   # git not installed in container
error: cannot check staged changes: git is unavailable
// after
$ apt-get install -y git
$ mise dot sync   # succeeds
Defensive patterns

Strategy: fallback

Validate before calling

command -v git >/dev/null 2>&1 || { echo 'git required for mise dot sync'; exit 1; }

Try / catch

if err.contains('git is unavailable') {
    // fall back: install git or skip sync with a warning
}

Prevention

When it happens

Trigger: `mise dot sync` (pull) runs on a machine where the git plumbing binary cannot be found: git is not installed, not on PATH, or the configured/plumbing binary path is invalid.

Common situations: Minimal containers or CI images without git; a broken PATH in the environment running mise; a mise install where the git lookup setting points at a missing binary.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/ee466ab64263dffc. Report an issue: GitHub.

Appendix: source

Thrown at src/system/history/sync/apply.rs:1001

    repo.restored_object_at(&head, &entry.tree_path(path)?)
}

/// Read each containing checkout's index once per preflight, not once per
/// incoming file. Never retain this observation across subsequent validation.
pub(super) fn staged_paths<'a>(paths: impl Iterator<Item = &'a Path>) -> Result<BTreeSet<PathBuf>> {
    let roots: BTreeSet<_> = paths
        .filter_map(|path| {
            path.ancestors()
                .find(|dir| dir.join(".git").exists())
                .map(Path::to_path_buf)
        })
        .collect();
    let mut staged = BTreeSet::new();
    if roots.is_empty() {
        return Ok(staged);
    }
    let Some(git) = crate::git::plumbing_binary() else {
        bail!("cannot check staged changes: git is unavailable");
    };
    for root in roots {
        let mut command = std::process::Command::new(git);
        crate::git::sanitize_git_command(&mut command);
        let output = command
            .arg("-C")
            .arg(&root)
            .args([
                "-c",
                "core.fsmonitor=false",
                "diff",
                "--cached",
                "--name-only",
                "-z",
                "--no-renames",
                "--no-ext-diff",
                "--no-textconv",
                "--",

View on GitHub (pinned to 533346cc37)