jdx/mise · error

has no branch ` `; it has: . Connect with `--branch `, or…

Error message

{url} has no branch `{branch}`; it has: {}{suffix}. Connect with `--branch <name>`, or push `{branch}` there first.

What it means

Before connecting, mise checks the remote for the requested branch's head. If the remote does not publish that branch, the error lists the branches it does have (truncated with '(and N more)') and tells the user to pick one with `--branch` or push the branch upstream.

Solutions

  1. Push the branch to the remote: `git push origin <branch>`
  2. Connect with an existing branch: `mise dot origin set <url> --branch <listed-name>`
  3. Verify the URL points at the intended repository

Example fix

// before
mise dot origin set git@github.com:user/repo.git --branch maain
// after
git push origin main
mise dot origin set git@github.com:user/repo.git --branch main
Defensive patterns

Strategy: validation

Validate before calling

git ls-remote --heads <url> | grep -q "refs/heads/$BRANCH$" \
  || { echo "branch $BRANCH not on remote; push it or pick another"; exit 1; }

Try / catch

match result {
    Err(e) if e.to_string().contains("has no branch") => {
        eprintln!("push the branch or connect with one of the listed branches");
    }
    _ => {}
}

Prevention

When it happens

Trigger: set_inner -> refuse_missing_branch: the fetched remote heads for `{url}` do not include the target `branch` (typo, branch only exists locally, or the remote is the wrong repo).

Common situations: Typo in the branch name; the branch was never pushed (`git push -u origin branch` not run); pointing at a fork/remote that lacks the branch; shal-listed remote hiding the branch.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at src/system/history/sync/origin.rs:280

    // a listing that fails must not read as an empty repository: that is the
    // path this check exists to prevent
    let refs = remote.ls_remote()?;
    let heads: Vec<&str> = refs
        .iter()
        .filter_map(|(_, name)| name.strip_prefix("refs/heads/"))
        .collect();
    if heads.is_empty() || heads.contains(&branch) {
        return Ok(());
    }
    let mut listed: Vec<&str> = heads.iter().copied().take(10).collect();
    listed.sort_unstable();
    let more = heads.len().saturating_sub(listed.len());
    let suffix = if more > 0 {
        format!(" (and {more} more)")
    } else {
        String::new()
    };
    bail!(
        "{url} has no branch `{branch}`; it has: {}{suffix}. Connect with `--branch <name>`, or push `{branch}` there first.",
        listed.join(", ")
    );
}

pub(crate) fn report(outcome: &run::SyncOutcome) {
    match &outcome.published {
        Some(commit) => info!(
            "history: published {}",
            crate::cli::dotfiles::history::short(commit)
        ),
        None => info!("history: nothing new to publish"),
    }
    if outcome.pending > 0 {
        info!(
            "history: {} incoming change(s) pending; `mise dot pull` applies them",
            outcome.pending
        );

View on GitHub (pinned to 533346cc37)