jdx/mise · error

{} exists but is not a git checkout with an origin remote

Error message

{} exists but is not a git checkout with an origin remote

What it means

mise's bootstrap found an existing directory at the expected checkout path, but it is not a git checkout with an `origin` remote (the `git config --get remote.origin.url` call failed), so mise refuses to reuse it. This guards against reusing a non-git or misconfigured directory as a bootstrap checkout.

Source

Thrown at src/cli/bootstrap.rs:212

    command.arg("-C").arg(checkout).args(args);
    crate::git::sanitize_git_command(&mut command);
    let status = command.status()?;
    if !status.success() {
        bail!("git command failed with {status}");
    }
    Ok(())
}

fn validate_bootstrap_checkout(checkout: &Path, url: &str) -> Result<()> {
    let mut command = Command::new("git");
    command
        .arg("-C")
        .arg(checkout)
        .args(["config", "--get", "remote.origin.url"]);
    crate::git::sanitize_git_command(&mut command);
    let output = command.output()?;
    if !output.status.success() {
        bail!(
            "{} exists but is not a git checkout with an origin remote",
            checkout.display_user()
        );
    }
    let origin = String::from_utf8(output.stdout)?.trim().to_string();
    if origin != url {
        bail!(
            "{} has origin {origin:?}, expected {url:?}",
            checkout.display_user()
        );
    }
    Ok(())
}

fn bootstrap_resource_is_skipped(resource: &ResourceId, skip: &HashSet<BootstrapPart>) -> bool {
    let part = match resource.kind.as_str() {
        "package" => BootstrapPart::Packages,
        "file" | "directory" => BootstrapPart::Files,

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Delete the stale directory and let mise re-clone it (e.g. `rm -rf <bootstrap-checkout-path>` then re-run).
  2. If the directory should be kept, add the correct origin: `git -C <path> remote add origin <url>`.
  3. Re-initialize the checkout with the intended URL so the origin remote matches.

Example fix

// before: keeping a repo without origin
# (mise errors)
// after
git -C ~/.local/share/mise/bootstrap/repo remote add origin https://github.com/org/repo.git
Defensive patterns

Strategy: validation

Validate before calling

test -d <path>/.git && git -C <path> config --get remote.origin.url >/dev/null 2>&1 || echo 'not a git checkout with origin; remove it so mise re-clones'

Prevention

When it happens

Trigger: `run_from` bootstrap flow finds `<bootstrap-dir>` present but plain/uninitialized or a git repo without an origin remote, making `git config --get remote.origin.url` exit non-zero.

Common situations: A stale plain directory created manually at the bootstrap path, a repo cloned then its origin removed, or a partially initialized checkout left by an interrupted run.

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/eb5bb72a4d6fac54. Report an issue: GitHub.