jdx/mise · error

global configuration origin does not match

Error message

global configuration origin does not match

What it means

During onboarding of a shared global-configuration repository, install_at found an existing Git checkout at the destination whose `origin` remote URL differs from the origin of the transferred bundle. The tool refuses to overwrite or fast-forward a repository that points at a different upstream, because merging unrelated configurations would silently mix two sources of truth. It aborts instead of guessing which origin the user intended.

Source

Thrown at src/system/remote_repository.rs:249

            || entry.split('/').any(|p| p.eq_ignore_ascii_case(".git"))
        {
            bail!("unsafe source repository path");
        }
        if entry.to_ascii_lowercase().ends_with(".local.toml") {
            bail!(
                "source contains machine-local configuration ({entry}); remove it from the repository before onboarding"
            );
        }
    }
    git(&checkout, &["remote", "set-url", "origin", origin])?;
    let branch = git(&checkout, &["symbolic-ref", "--short", "HEAD"])?;
    git(
        &checkout,
        &["-c", "core.hooksPath=/dev/null", "checkout", &branch],
    )?;
    if destination.join(".git").exists() {
        if git(destination, &["remote", "get-url", "origin"])? != origin {
            bail!("global configuration origin does not match");
        }
        if !git(
            destination,
            &["status", "--porcelain", "--untracked-files=no"],
        )?
        .is_empty()
        {
            bail!("global configuration has uncommitted changes");
        }
        if update {
            if git(destination, &["symbolic-ref", "--short", "HEAD"])? != branch {
                bail!("global configuration branch differs from the transferred branch");
            }
            if dry_run {
                // the bundle holds the history from the checkout's commit on,
                // so the fast-forward is checked there without fetching into
                // the destination
                let head = git(destination, &["rev-parse", "HEAD"])?;

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Compare `git -C <destination> remote get-url origin` with the origin in the transfer source and make them identical (prefer one canonical URL form).
  2. Update the destination's remote: `git -C <destination> remote set-url origin <origin>` so it matches the transferred repository's origin.
  3. If the destination is genuinely a different repository, move it aside (or delete it) so the tool can clone the transferred configuration fresh.
  4. Fix the origin in the configuration/transfer source to match the existing checkout's remote URL.

Example fix

// before: transfer origin is git@github.com:alice/config.git but destination has https://github.com/alice/config.git
git -C ~/.config/mise remote set-url origin git@github.com:alice/config.git
// after: rerun the install; origin URLs now match byte-for-byte
Defensive patterns

Strategy: validation

Validate before calling

const origin = 'git@github.com:alice/config.git';
const dest = process.env.HOME + '/.config/mise';
if (fs.existsSync(path.join(dest, '.git'))) {
  const cur = execFileSync('git', ['-C', dest, 'remote', 'get-url', 'origin']).toString().trim();
  if (cur !== origin) throw new Error(`origin mismatch: ${cur} !== ${origin}`);
}

Prevention

When it happens

Trigger: Running a global-config install/transfer (install, install_source, or preview_source) into a directory that already contains a `.git` whose `git remote get-url origin` string is not byte-identical to the transfer's origin URL (e.g. `https://` vs `ssh://`, trailing `.git`, or a fork).

Common situations: User previously cloned their dotfiles/config repo via HTTPS and now transfers via SSH (or vice versa); the destination is a different repo entirely; the origin was re-hosted or renamed and the transfer spec still has the old URL.

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