jdx/mise · error

git clone failed with {status}

Error message

git clone failed with {status}

What it means

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.

Source

Thrown at src/cli/bootstrap.rs:4249

        }
        return Ok(true);
    }
    if dry_run {
        miseprintln!("Would run: git clone {} {}", url, checkout.display_user());
        return Ok(false);
    }
    if let Some(parent) = checkout
        .parent()
        .filter(|parent| !parent.as_os_str().is_empty())
    {
        std::fs::create_dir_all(parent)?;
    }
    let mut command = Command::new("git");
    command.arg("clone").arg(url).arg(checkout);
    crate::git::sanitize_git_command(&mut command);
    let status = command.status()?;
    if !status.success() {
        bail!("git clone failed with {status}");
    }
    journal::note(format!("cloned {url} into {}", checkout.display_user()));
    Ok(true)
}

fn bootstrap_hooks_enabled() -> bool {
    !(config::Settings::no_hooks()
        || config::Settings::get().no_hooks.unwrap_or(false)
        || config::Settings::get().safe)
}

async fn run_bootstrap_hooks(
    config: &Config,
    hooks: &[hooks::BootstrapHook],
    phase: BootstrapHookPhase,
    dry_run: bool,
) -> Result<()> {
    if !bootstrap_hooks_enabled() {

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Run the same `git clone <url> <target>` manually to see git's stderr and exact cause
  2. Add credentials (SSH key, token, or git credential helper) for the remote
  3. Remove or clear the target directory if it already exists and blocks a fresh clone
  4. Check network/VPN/proxy settings; verify the URL is reachable (git ls-remote <url>)

Example fix

// before: clone fails because target dir already exists
mise bootstrap repo-existing-dir
// after: remove or empty the target first
rm -rf repo-existing-dir && mise bootstrap repo-existing-dir
Defensive patterns

Strategy: try-catch

Validate before calling

git ls-remote <url> >/dev/null 2>&1 && test ! -d <target> || echo 'preconditions fail'

Try / catch

try {
  execSync('mise bootstrap');
} catch (e) {
  if (/git clone failed/.test(e.message)) {
    // re-run clone manually to capture git's stderr
    execSync(`git clone ${url} ${target}`, { stdio: 'inherit' });
  }
}

Prevention

When it happens

Trigger: `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.

Common situations: Private repos without SSH keys or tokens configured; typo'd repo URL; destination directory already populated; firewall/VPN blocking github.com.

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@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/dd0d3bd84571e9d7. Report an issue: GitHub.