gitbutlerapp/gitbutler · error
failed to push of branch
Error message
failed to push {} of {} branch{} What it means
Summary failure raised by push_all_branches after a multi-branch push attempt: some of the attempted branches failed to reach the remote. It aggregates how many of the total branches failed, and the per-branch errors are printed just above in human output. Check the listed branch errors (auth, remote rejection, etc.) and retry the push.
Solutions
- Check the earlier per-branch error output for the root cause of each failed branch
- Re-run `but push` for the failed branches individually to see the detailed error
- Inspect branch state with `but status` and resolve conflicts before pushing
- Retry after network/auth issues are resolved
Defensive patterns
Strategy: try-catch
Validate before calling
let failed: Vec<_> = branches.iter().filter(|b| !pushed.contains(b)).collect();
if !failed.is_empty() { eprintln!("will fail: {:?}", failed); } Try / catch
match push_all_branches(ctx).await {
Err(e) if e.to_string().contains("failed to push") => {
eprintln!("{e:#}; see per-branch output above for root causes");
}
Err(e) => return Err(e),
Ok(_) => {}
} Prevention
- Resolve all conflicts (but status) before bulk pushing
- Push branches individually to isolate failures
- Check remote connectivity/auth before `--all` pushes
When it happens
Trigger: Running `but push --all` (push_all_branches) when one or more branches fail their individual push, e.g. due to remote rejection, conflicts, or upstream errors.
Common situations: Remote rejects a non-fast-forward push; network failures mid-push; branches with unmerged or conflicted commits that the upstream refuses.
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
- Aborting due to empty branch name
- Bare repositories are not supported.
- Branch ' ' not found
- Branch ' ' not found when checking for conflicts
- Branch ` ` is pushed, but its remote ancestry does not…
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/69257c324d0ab0d8.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but/src/command/legacy/push.rs:834
"branch"
} else {
"branches"
}
)?;
for failed in &failed_branches {
writeln!(
human,
" {} - {}",
t.error.paint(&failed.branch_name),
t.hint.paint(&failed.error)
)?;
}
}
}
if !failed_branches.is_empty() {
let attempted = failed_branches.len() + pushed_results.len();
anyhow::bail!(
"failed to push {} of {} branch{}",
failed_branches.len(),
attempted,
if attempted == 1 { "" } else { "es" }
);
}
Ok(())
}
fn handle_no_branch_specified(
ctx: &Context,
out: &mut OutputChannel,
) -> anyhow::Result<BranchSelection> {
let t = theme::get();
// Check if we're in an interactive terminal with human output format.
// This comes first: push_all_branches computes its own candidates, soView on GitHub (pinned to 58e5313667)