{"record":{"id":"ff54729e49270b25","repo":"jdx/mise","slug":"url-has-no-branch-branch-it-has-suffix-connect-with-branch","errorCode":null,"errorMessage":"{url} has no branch `{branch}`; it has: {}{suffix}. Connect with `--branch <name>`, or push `{branch}` there first.","messagePattern":"(.+?) has no branch `(.+?)`; it has: (.+?)(.+?)\\. Connect with `--branch <name>`, or push `(.+?)` there first\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/history/sync/origin.rs","lineNumber":280,"sourceCode":"    // a listing that fails must not read as an empty repository: that is the\n    // path this check exists to prevent\n    let refs = remote.ls_remote()?;\n    let heads: Vec<&str> = refs\n        .iter()\n        .filter_map(|(_, name)| name.strip_prefix(\"refs/heads/\"))\n        .collect();\n    if heads.is_empty() || heads.contains(&branch) {\n        return Ok(());\n    }\n    let mut listed: Vec<&str> = heads.iter().copied().take(10).collect();\n    listed.sort_unstable();\n    let more = heads.len().saturating_sub(listed.len());\n    let suffix = if more > 0 {\n        format!(\" (and {more} more)\")\n    } else {\n        String::new()\n    };\n    bail!(\n        \"{url} has no branch `{branch}`; it has: {}{suffix}. Connect with `--branch <name>`, or push `{branch}` there first.\",\n        listed.join(\", \")\n    );\n}\n\npub(crate) fn report(outcome: &run::SyncOutcome) {\n    match &outcome.published {\n        Some(commit) => info!(\n            \"history: published {}\",\n            crate::cli::dotfiles::history::short(commit)\n        ),\n        None => info!(\"history: nothing new to publish\"),\n    }\n    if outcome.pending > 0 {\n        info!(\n            \"history: {} incoming change(s) pending; `mise dot pull` applies them\",\n            outcome.pending\n        );","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/history/sync/origin.rs#L262-L298","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Push the branch to the remote: `git push origin <branch>`","Connect with an existing branch: `mise dot origin set <url> --branch <listed-name>`","Verify the URL points at the intended repository"],"exampleFix":"// before\nmise dot origin set git@github.com:user/repo.git --branch maain\n// after\ngit push origin main\nmise dot origin set git@github.com:user/repo.git --branch main","handlingStrategy":"validation","validationCode":"git ls-remote --heads <url> | grep -q \"refs/heads/$BRANCH$\" \\\n  || { echo \"branch $BRANCH not on remote; push it or pick another\"; exit 1; }","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"has no branch\") => {\n        eprintln!(\"push the branch or connect with one of the listed branches\");\n    }\n    _ => {}\n}","preventionTips":["Run `git push -u origin <branch>` before connecting a new branch","Check branch names with `git ls-remote --heads <url>`","Confirm the remote URL points at the intended repository"],"tags":["git","network","branch","remote"],"backgroundTag":"resource-not-found","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"}