jdx/mise · error

git failed with status

Error message

git failed with status {status}

What it means

`run_command` is the fire-and-forget git runner used by clone_repo and git_run. When the spawned git process cannot even be started or exits non-zero, it either wraps the spawn error or bails with the raw exit status. Unlike git_output it does not capture stderr, so output is whatever git printed to the inherited terminal.

Solutions

  1. Read git's output printed before the status line (git writes to the same terminal) for the real cause.
  2. Verify the repo URL and your credentials (ssh -T git@..., gh auth status).
  3. If a fetch/pull ref failed, confirm the remote ref still exists with `git ls-remote origin <ref>` and update the config.
  4. Check network connectivity/proxy settings, then re-run the mise repos command.

Example fix

// before: private repo without auth
[[repos]]
url = "git@github.com:acme/private.git"
// after: ensure the SSH key is available or use an authenticated URL
ssh-add ~/.ssh/id_ed25519
mise repos bootstrap
Defensive patterns

Strategy: try-catch

Validate before calling

# Check connectivity and auth before bootstrap
ssh -T git@github.com || true
git ls-remote "$url" HEAD >/dev/null && echo "remote reachable"

Try / catch

// run_command bails with the raw status; wrap clone/bootstrap and retry on transient network errors
if let Err(e) = repos_bootstrap() {
    if e.to_string().contains("git failed with status") {
        eprintln!("git subprocess failed: {e:#}; check git's terminal output");
    }
}

Prevention

When it happens

Trigger: `mise repos bootstrap/clone` spawning `git clone` or `git fetch/checkout/pull` where git exits non-zero (auth failure, unknown host, missing network, ref not found) or the git binary fails to spawn.

Common situations: Cloning a private repo without SSH keys/credentials; URL typo causing 'Repository not found'; offline machine; remote branch/pull_ref deleted so `pull --ff-only origin <ref>` fails.

Understand the failure class

Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.

Related errors


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

Appendix: source

Thrown at src/system/repos.rs:771

fn git_run(path: &Path, args: &[&str]) -> Result<()> {
    let safe = format!("safe.directory={}", path.display());
    run_command(
        Command::new("git")
            .arg("-C")
            .arg(path)
            .arg("-c")
            .arg(safe)
            .arg("-c")
            .arg("core.autocrlf=false")
            .args(args),
    )
}

fn run_command(cmd: &mut Command) -> Result<()> {
    debug!("$ {:?}", cmd);
    let status = cmd.status().map_err(|err| eyre!("git failed: {err:#}"))?;
    if !status.success() {
        bail!("git failed with status {status}");
    }
    Ok(())
}

fn print_git_command(path: &Path, args: &[&str]) -> Result<()> {
    let mut parts = vec![
        "git".to_string(),
        "-C".to_string(),
        path.display().to_string(),
        "-c".to_string(),
        format!("safe.directory={}", path.display()),
        "-c".to_string(),
        "core.autocrlf=false".to_string(),
    ];
    parts.extend(args.iter().map(|arg| arg.to_string()));
    miseprintln!("{}", shell_words::join(parts));
    Ok(())
}

View on GitHub (pinned to 533346cc37)