{"record":{"id":"dd0d3bd84571e9d7","repo":"jdx/mise","slug":"git-clone-failed-with-status","errorCode":null,"errorMessage":"git clone failed with {status}","messagePattern":"git clone failed with (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/bootstrap.rs","lineNumber":4249,"sourceCode":"        }\n        return Ok(true);\n    }\n    if dry_run {\n        miseprintln!(\"Would run: git clone {} {}\", url, checkout.display_user());\n        return Ok(false);\n    }\n    if let Some(parent) = checkout\n        .parent()\n        .filter(|parent| !parent.as_os_str().is_empty())\n    {\n        std::fs::create_dir_all(parent)?;\n    }\n    let mut command = Command::new(\"git\");\n    command.arg(\"clone\").arg(url).arg(checkout);\n    crate::git::sanitize_git_command(&mut command);\n    let status = command.status()?;\n    if !status.success() {\n        bail!(\"git clone failed with {status}\");\n    }\n    journal::note(format!(\"cloned {url} into {}\", checkout.display_user()));\n    Ok(true)\n}\n\nfn bootstrap_hooks_enabled() -> bool {\n    !(config::Settings::no_hooks()\n        || config::Settings::get().no_hooks.unwrap_or(false)\n        || config::Settings::get().safe)\n}\n\nasync fn run_bootstrap_hooks(\n    config: &Config,\n    hooks: &[hooks::BootstrapHook],\n    phase: BootstrapHookPhase,\n    dry_run: bool,\n) -> Result<()> {\n    if !bootstrap_hooks_enabled() {","sourceCodeStart":4231,"sourceCodeEnd":4267,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/cli/bootstrap.rs#L4231-L4267","documentation":"During repository bootstrap, mise shells out to `git clone <url> <target>` (with `crate::git::sanitize_git_command` applied). If the spawned git process exits non-zero, mise bails with the git exit status. The actual stderr from git is printed by the child process itself; this error surfaces the failure to the bootstrap journal/caller.","triggerScenarios":"`git clone` exits non-zero: unknown or unreachable URL, missing read credentials (private repo), target directory already exists and is not empty, network failure, or invalid ref/checkout path.","commonSituations":"Private repos without SSH keys or tokens configured; typo'd repo URL; destination directory already populated; firewall/VPN blocking github.com.","solutions":["Run the same `git clone <url> <target>` manually to see git's stderr and exact cause","Add credentials (SSH key, token, or git credential helper) for the remote","Remove or clear the target directory if it already exists and blocks a fresh clone","Check network/VPN/proxy settings; verify the URL is reachable (git ls-remote <url>)"],"exampleFix":"// before: clone fails because target dir already exists\nmise bootstrap repo-existing-dir\n// after: remove or empty the target first\nrm -rf repo-existing-dir && mise bootstrap repo-existing-dir","handlingStrategy":"try-catch","validationCode":"git ls-remote <url> >/dev/null 2>&1 && test ! -d <target> || echo 'preconditions fail'","typeGuard":null,"tryCatchPattern":"try {\n  execSync('mise bootstrap');\n} catch (e) {\n  if (/git clone failed/.test(e.message)) {\n    // re-run clone manually to capture git's stderr\n    execSync(`git clone ${url} ${target}`, { stdio: 'inherit' });\n  }\n}","preventionTips":["Verify remote reachability with git ls-remote before bootstrapping","Configure SSH keys or credential helpers for private repos","Ensure target directories are absent or empty before clone","Check proxy/VPN settings in restricted networks"],"tags":["git","clone","subprocess"],"backgroundTag":"git-command-failed","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}