{"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":"validation","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/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/system/remote_repository.rs#L231-L267","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Compare `git -C <destination> remote get-url origin` with the origin in the transfer source and make them identical (prefer one canonical URL form).","Update the destination's remote: `git -C <destination> remote set-url origin <origin>` so it matches the transferred repository's origin.","If the destination is genuinely a different repository, move it aside (or delete it) so the tool can clone the transferred configuration fresh.","Fix the origin in the configuration/transfer source to match the existing checkout's remote URL."],"exampleFix":"// before: transfer origin is git@github.com:alice/config.git but destination has https://github.com/alice/config.git\ngit -C ~/.config/mise remote set-url origin git@github.com:alice/config.git\n// after: rerun the install; origin URLs now match byte-for-byte","handlingStrategy":"validation","validationCode":"const origin = 'git@github.com:alice/config.git';\nconst dest = process.env.HOME + '/.config/mise';\nif (fs.existsSync(path.join(dest, '.git'))) {\n  const cur = execFileSync('git', ['-C', dest, 'remote', 'get-url', 'origin']).toString().trim();\n  if (cur !== origin) throw new Error(`origin mismatch: ${cur} !== ${origin}`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pick one canonical origin URL form (SSH or HTTPS) and use it everywhere.","Run `git remote get-url origin` in the destination before transferring to compare.","After repo re-hosting/renames, update all clones' remotes before re-running transfers."],"tags":["git","remote-origin","configuration"],"backgroundTag":"git-command-failed","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}