gitbutlerapp/gitbutler · error
Neither found push remote found in workspace nor…
Error message
Neither found push remote found in workspace nor unambiguously in the Git repository configuration.
What it means
`check_project_setup` requires a push remote: it first asks the workspace (`ws.push_remote_name()`) and falls back to the repository's default push remote (`repo.remote_default_name(Direction::Push)`). If neither is defined, there is no unambiguous destination for `git push`, so setup bails.
Solutions
- Add/configure a remote: `git remote add origin <url>` (or set `git config remote.pushDefault origin`).
- Verify with `git remote -v` that a push URL exists and that `git config remote.pushDefault` or a single obvious remote resolves it.
- Set the workspace's push remote explicitly if you want a non-default destination.
Example fix
// before $ git remote -v # empty or fetch-only // after $ git remote add origin git@github.com:me/repo.git $ git config remote.pushDefault origin
Defensive patterns
Strategy: validation
Validate before calling
let has_remote = std::process::Command::new("git")
.args(["config", "remote.pushDefault"])
.output()
.map(|o| !o.stdout.is_empty())
.unwrap_or(false);
if !has_remote {
eprintln!("configure a push remote: git remote add origin <url> and/or git config remote.pushDefault origin");
std::process::exit(1);
} Type guard
fn has_push_remote(ws: &Workspace) -> bool {
ws.push_remote_name().is_some()
} Try / catch
match result {
Err(e) if e.to_string().contains("push remote") => {
// guide user to `git remote add` / `git config remote.pushDefault`
}
Err(e) => return Err(e),
Ok(v) => v,
} Prevention
- Always configure `origin` (or `remote.pushDefault`) before enabling GitButler on a repo
- Run `git remote -v` to confirm push URLs exist
- Avoid removing the only remote while the workspace depends on it
When it happens
Trigger: Calling `init_ctx` on a `gitbutler/*` branch when no push remote is configured in the workspace AND the git config has no default push remote (no `remote.pushDefault`, and either no `origin` or multiple remotes with no clear push default).
Common situations: Fresh clone with remotes named other than `origin` and no `remote.pushDefault`; repo with only fetch remotes configured; repo where `origin` was removed; local-only repo that later started using GitButler.
Understand the failure class
Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.
Related errors
- No HEAD reference found for remote
- Aborting due to empty branch name
- Bare repositories are not supported.
- Branch ' ' not found
- Branch ' ' not found when checking for conflicts
AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18).
Data as JSON: /api/errors/720c101e50da0284.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but/src/command/legacy/setup.rs:575
// The workspace graph built from gitbutler/edit doesn't expose the target ref or
// remote configuration, but both are still configured in virtual_branches.toml
// and will be accessible when returning to gitbutler/workspace.
if head_name == b"gitbutler/edit" {
return Ok(true);
}
// TODO(legacy): it's fine to have no target.
if ws.graph.project_meta.target_ref.is_none() {
anyhow::bail!("No default target branch set.");
}
// check if there is a remote
if ws.push_remote_name().is_none()
&& repo
.remote_default_name(gix::remote::Direction::Push)
.is_none()
{
anyhow::bail!(
"Neither found push remote found in workspace nor unambiguously in the Git repository configuration."
)
};
Ok(true)
}
/// Creates a 'gb-local' remote pointing to this repository and creates tracking refs for the default branch.
fn setup_local_remote(repo: &gix::Repository, out: &mut OutputChannel) -> anyhow::Result<String> {
let t = theme::get();
let repo_url = repo
.workdir()
.ok_or_else(|| anyhow::anyhow!("Repository has no working directory"))?
.to_str()
.ok_or_else(|| anyhow::anyhow!("Repository path is not valid UTF-8"))?;
if let Some(out) = out.for_human() {
writeln!(View on GitHub (pinned to 58e5313667)