jdx/mise · error

global configuration origin does not match

Error message

global configuration origin does not match

What it means

When the destination directory already contains a `.git` directory (an existing global-configuration checkout), mise verifies that its `origin` remote URL matches the origin of the repository being installed. A mismatch means the existing checkout is a different repository than the one being transferred, so proceeding could mix unrelated histories. The comparison is an exact string equality of `git remote get-url origin` against the expected origin.

Solutions

  1. Point the destination's origin at the expected URL: `git -C <destination> remote set-url origin <expected-origin>`.
  2. Confirm both URLs resolve to the same repository and normalize the form (e.g. both SSH or both HTTPS) on every machine.
  3. If the destination is genuinely a different repository, move it aside and let the install create a fresh checkout.
  4. Re-run the install after the remote matches.

Example fix

// before
$ git -C ~/.config/mise remote get-url origin
https://github.com/acme/mise-config.git

// after (expected origin is SSH form)
$ git -C ~/.config/mise remote set-url origin git@github.com:acme/mise-config.git
Defensive patterns

Strategy: validation

Validate before calling

const { execSync } = require('child_process');
const current = execSync('git -C ' + dest + ' remote get-url origin', { stdio: ['ignore','pipe','ignore'] }).toString().trim();
if (current && current !== expectedOrigin) throw new Error(`origin mismatch: ${current} != ${expectedOrigin}`);

Try / catch

try {
  await installSource(bundle, origin);
} catch (e) {
  if (/origin does not match/.test(String(e.cause ?? e))) {
    execSync(`git -C ${dest} remote set-url origin ${origin}`);
    return installSource(bundle, origin); // retry once after fixing the remote
  }
  throw e;
}

Prevention

When it happens

Trigger: Running install/install_source/preview_source (install_at) into a destination that already has a `.git` whose `origin` URL differs from the transferred repository's origin — including URL spelling differences such as `https://` vs `git@github.com:` forms, a trailing `.git`, or a renamed/moved remote.

Common situations: The global config repo was re-pointed to a new remote URL on one machine but not the other; the destination was initialized from a fork; HTTPS-to-SSH remote migration left URLs inconsistent between machines.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/d511b14333975cea. Report an issue: GitHub.

Appendix: 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 533346cc37)