jdx/mise · error

global configuration has uncommitted changes

Error message

global configuration has uncommitted changes

What it means

install_at detected uncommitted changes (`git status --porcelain`, tracked files only) in an existing Git checkout at the destination before applying the transferred global configuration. The tool refuses to overwrite a dirty worktree because the operation could destroy or mix local edits. It requires a clean checkout before any update or comparison proceeds.

Source

Thrown at src/system/remote_repository.rs:257

        }
    }
    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"])?;
                if head == revision {
                    miseprintln!(
                        "Would keep {shown} at {revision}, already the transferred revision"
                    );
                } else if git(&checkout, &["merge-base", "--is-ancestor", &head, revision]).is_ok()
                {
                    miseprintln!("Would fast-forward {shown} from {head} to {revision}");
                } else {

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Run `git -C <destination> status` and commit the changes: `git add -A && git commit -m "local changes"`.
  2. Stash instead of committing: `git -C <destination> stash --include-untracked`.
  3. Discard unwanted edits: `git -C <destination> checkout -- .` (after verifying nothing valuable is lost).
  4. Move uncommitted work to the source repository, push it, and re-run the transfer so the bundle contains those changes.

Example fix

// before: install fails with dirty worktree
git -C ~/.config/mise status --porcelain   # shows M config.toml
git -C ~/.config/mise add -A && git -C ~/.config/mise commit -m "sync local edits"
// after: worktree is clean; rerun the install
Defensive patterns

Strategy: validation

Validate before calling

const dest = process.env.HOME + '/.config/mise';
if (fs.existsSync(path.join(dest, '.git'))) {
  const status = execFileSync('git', ['-C', dest, 'status', '--porcelain', '--untracked-files=no']).toString();
  if (status.length > 0) throw new Error('destination worktree is dirty; commit or stash first');
}

Prevention

When it happens

Trigger: Installing/updating a global-config repository into a destination that already has a `.git` and modified or staged-but-uncommitted tracked files (untracked files are ignored, tracked modifications are not).

Common situations: User hand-edited their global config.toml without committing; an editor or tool auto-modified tracked files; a merge/rebase was left in progress leaving staged changes.

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