{"record":{"id":"f1ab776259da82e0","repo":"jdx/mise","slug":"git-failed-with-status-status","errorCode":null,"errorMessage":"git failed with status {status}","messagePattern":"git failed with status (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/repos.rs","lineNumber":771,"sourceCode":"fn git_run(path: &Path, args: &[&str]) -> Result<()> {\n    let safe = format!(\"safe.directory={}\", path.display());\n    run_command(\n        Command::new(\"git\")\n            .arg(\"-C\")\n            .arg(path)\n            .arg(\"-c\")\n            .arg(safe)\n            .arg(\"-c\")\n            .arg(\"core.autocrlf=false\")\n            .args(args),\n    )\n}\n\nfn run_command(cmd: &mut Command) -> Result<()> {\n    debug!(\"$ {:?}\", cmd);\n    let status = cmd.status().map_err(|err| eyre!(\"git failed: {err:#}\"))?;\n    if !status.success() {\n        bail!(\"git failed with status {status}\");\n    }\n    Ok(())\n}\n\nfn print_git_command(path: &Path, args: &[&str]) -> Result<()> {\n    let mut parts = vec![\n        \"git\".to_string(),\n        \"-C\".to_string(),\n        path.display().to_string(),\n        \"-c\".to_string(),\n        format!(\"safe.directory={}\", path.display()),\n        \"-c\".to_string(),\n        \"core.autocrlf=false\".to_string(),\n    ];\n    parts.extend(args.iter().map(|arg| arg.to_string()));\n    miseprintln!(\"{}\", shell_words::join(parts));\n    Ok(())\n}","sourceCodeStart":753,"sourceCodeEnd":789,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/repos.rs#L753-L789","documentation":"`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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["Read git's output printed before the status line (git writes to the same terminal) for the real cause.","Verify the repo URL and your credentials (ssh -T git@..., gh auth status).","If a fetch/pull ref failed, confirm the remote ref still exists with `git ls-remote origin <ref>` and update the config.","Check network connectivity/proxy settings, then re-run the mise repos command."],"exampleFix":"// before: private repo without auth\n[[repos]]\nurl = \"git@github.com:acme/private.git\"\n// after: ensure the SSH key is available or use an authenticated URL\nssh-add ~/.ssh/id_ed25519\nmise repos bootstrap","handlingStrategy":"try-catch","validationCode":"# Check connectivity and auth before bootstrap\nssh -T git@github.com || true\ngit ls-remote \"$url\" HEAD >/dev/null && echo \"remote reachable\"","typeGuard":null,"tryCatchPattern":"// run_command bails with the raw status; wrap clone/bootstrap and retry on transient network errors\nif let Err(e) = repos_bootstrap() {\n    if e.to_string().contains(\"git failed with status\") {\n        eprintln!(\"git subprocess failed: {e:#}; check git's terminal output\");\n    }\n}","preventionTips":["Set up SSH keys or tokens for private repos before running repos bootstrap.","Validate repo URLs with git ls-remote before adding them to config.","Ensure network/proxy access to the git hosts you track.","Confirm pinned/fetched refs still exist on the remote (remotes can delete branches)."],"tags":["git","subprocess","clone"],"backgroundTag":"git-command-failed","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}