gitbutlerapp/gitbutler · error

Neither found push remote found in workspace nor unambiguous

Error message

Neither found push remote found in workspace nor unambiguously in the Git repository configuration.

What it means

check_project_setup (crates/but/src/command/legacy/setup.rs:525) bails when neither the workspace names a remote (ws.remote_name() is None) nor the Git config yields an unambiguous push remote (repo.remote_default_name(gix::remote::Direction::Push) is None). This happens with zero remotes, or when several remotes exist but nothing (remote.pushDefault, branch.<name>.pushRemote) disambiguates which one is the default for pushing.

Source

Thrown at crates/but/src/command/legacy/setup.rs:525

    // 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.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 caf1f223d3)

Solutions

  1. Add exactly one remote: `git remote add origin <url>`.
  2. If multiple remotes are intentional, disambiguate with `git config remote.pushDefault origin` or `git config branch.<name>.pushRemote origin`.
  3. Re-run `but setup` so the chosen remote is recorded in the workspace configuration.

Example fix

# before
git remote -v   # (empty)
but status      # Neither found push remote found...

# after
git remote add origin git@github.com:org/repo.git
but status
Defensive patterns

Strategy: validation

Validate before calling

let has_remote = ws.remote_name().is_some()
    || repo.remote_default_name(gix::remote::Direction::Push).is_some();
if !has_remote {
    anyhow::bail!("configure a push remote (git remote add origin <url>) first");
}

Try / catch

match check_project_setup(&ctx, &perm) {
    Err(err) if err.to_string().contains("push remote") => {
        // guide user: git remote add origin <url> or set remote.pushDefault
    }
    other => other,
}

Prevention

When it happens

Trigger: Fresh `git init` repository with no remotes at all; two or more remotes configured without remote.pushDefault; workspace virtual_branches.toml lost its remote entry after manual edits.

Common situations: Local-only projects never connected to a forge; user added a second remote (e.g. upstream) and the default became ambiguous; remote removed or renamed out-of-band.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20). Data as JSON: /api/errors/720c101e50da0284. Report an issue: GitHub.