{"record":{"id":"d511b14333975cea","repo":"jdx/mise","slug":"global-configuration-origin-does-not-match","errorCode":null,"errorMessage":"global configuration origin does not match","messagePattern":"global configuration origin does not match","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/remote_repository.rs","lineNumber":249,"sourceCode":"            || entry.split('/').any(|p| p.eq_ignore_ascii_case(\".git\"))\n        {\n            bail!(\"unsafe source repository path\");\n        }\n        if entry.to_ascii_lowercase().ends_with(\".local.toml\") {\n            bail!(\n                \"source contains machine-local configuration ({entry}); remove it from the repository before onboarding\"\n            );\n        }\n    }\n    git(&checkout, &[\"remote\", \"set-url\", \"origin\", origin])?;\n    let branch = git(&checkout, &[\"symbolic-ref\", \"--short\", \"HEAD\"])?;\n    git(\n        &checkout,\n        &[\"-c\", \"core.hooksPath=/dev/null\", \"checkout\", &branch],\n    )?;\n    if destination.join(\".git\").exists() {\n        if git(destination, &[\"remote\", \"get-url\", \"origin\"])? != origin {\n            bail!(\"global configuration origin does not match\");\n        }\n        if !git(\n            destination,\n            &[\"status\", \"--porcelain\", \"--untracked-files=no\"],\n        )?\n        .is_empty()\n        {\n            bail!(\"global configuration has uncommitted changes\");\n        }\n        if update {\n            if git(destination, &[\"symbolic-ref\", \"--short\", \"HEAD\"])? != branch {\n                bail!(\"global configuration branch differs from the transferred branch\");\n            }\n            if dry_run {\n                // the bundle holds the history from the checkout's commit on,\n                // so the fast-forward is checked there without fetching into\n                // the destination\n                let head = git(destination, &[\"rev-parse\", \"HEAD\"])?;","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/remote_repository.rs#L231-L267","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Point the destination's origin at the expected URL: `git -C <destination> remote set-url origin <expected-origin>`.","Confirm both URLs resolve to the same repository and normalize the form (e.g. both SSH or both HTTPS) on every machine.","If the destination is genuinely a different repository, move it aside and let the install create a fresh checkout.","Re-run the install after the remote matches."],"exampleFix":"// before\n$ git -C ~/.config/mise remote get-url origin\nhttps://github.com/acme/mise-config.git\n\n// after (expected origin is SSH form)\n$ git -C ~/.config/mise remote set-url origin git@github.com:acme/mise-config.git","handlingStrategy":"validation","validationCode":"const { execSync } = require('child_process');\nconst current = execSync('git -C ' + dest + ' remote get-url origin', { stdio: ['ignore','pipe','ignore'] }).toString().trim();\nif (current && current !== expectedOrigin) throw new Error(`origin mismatch: ${current} != ${expectedOrigin}`);","typeGuard":null,"tryCatchPattern":"try {\n  await installSource(bundle, origin);\n} catch (e) {\n  if (/origin does not match/.test(String(e.cause ?? e))) {\n    execSync(`git -C ${dest} remote set-url origin ${origin}`);\n    return installSource(bundle, origin); // retry once after fixing the remote\n  }\n  throw e;\n}","preventionTips":["Use the identical remote URL form (SSH or HTTPS) on every machine","After renaming or migrating a repo remote, update the URL on all machines with git remote set-url","Include origin normalization in machine setup/bootstrap scripts"],"tags":["git","remote-origin","configuration","mismatch"],"backgroundTag":"invalid-config-value","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}