gitbutlerapp/gitbutler · error

Configured target branch has no push remote

Error message

Configured target branch has no push remote

What it means

Landing pushes the merged result, so a push remote name is required. When the base-branch metadata has no push remote configured and the fetch remote also resolved to empty, `branch_land` bails because it cannot determine where to push the landed target branch.

Solutions

  1. Add a remote (`git remote add origin <url>`) and re-configure the workspace target branch against it
  2. Re-set the push target in GitButler so `push_remote_name` points at an existing remote
  3. If the repo is intentionally local-only, land via plain git instead of `but merge`, which requires a remote target

Example fix

# before
but merge feature-branch
# error: Configured target branch has no push remote

# after
git remote add origin git@github.com:me/repo.git
but target set --remote origin --branch main
but merge feature-branch
Defensive patterns

Strategy: validation

Validate before calling

let push_remote = if base_branch.push_remote_name.is_empty() { &base_branch.remote_name } else { &base_branch.push_remote_name };
if push_remote.is_empty() {
    println!("no remote configured; add one with `git remote add`");
    return Ok(());
}

Try / catch

match land_result {
    Err(e) if e.to_string().contains("no push remote") => {
        add_remote_and_set_target();
        retry_land();
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling `but merge` when `base_branch.push_remote_name` is empty and `remote_name` (used as fallback) is also empty — the workspace target lacks any remote configured.

Common situations: Repo with no `origin` remote (local-only repository); target branch set up against a purely local branch; remote removed after the target was configured.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of gitbutlerapp/gitbutler@58e5313667 (2026-09-18). Data as JSON: /api/errors/b16d2c9d7a438f5d. Report an issue: GitHub.

Appendix: source

Thrown at crates/but-api/src/land/mod.rs:206

                );
            }
        }
        crate::legacy::virtual_branches::get_base_branch_data(ctx, guard.write_permission())?
            .ok_or_else(|| anyhow::anyhow!("No base branch configured"))?
    };

    let target_branch_name = base_branch.short_name.clone();
    if target_branch_name.is_empty() {
        bail!("Configured target branch has no branch name");
    }
    let fetch_remote_name = base_branch.remote_name.clone();
    let push_remote_name = if base_branch.push_remote_name.is_empty() {
        fetch_remote_name.clone()
    } else {
        base_branch.push_remote_name.clone()
    };
    if push_remote_name.is_empty() {
        bail!("Configured target branch has no push remote");
    }

    // Triangular remotes (fetch remote != push remote) are out of scope for now: the post-land
    // reconcile reads the fetch remote's tracking ref, so a push to a different remote would not
    // advance it and the reconcile would silently no-op. Refuse before mutating anything.
    if push_remote_name != fetch_remote_name {
        bail!(
            "`but merge` does not yet support triangular remotes (fetch `{fetch_remote_name}`, \
             push `{push_remote_name}`). Merge via a pull request instead, or configure a single \
             remote for the target branch."
        );
    }

    let target_display = format!("{push_remote_name}/{target_branch_name}");
    let push_remote_url = if base_branch.push_remote_url.is_empty() {
        &base_branch.remote_url
    } else {
        &base_branch.push_remote_url

View on GitHub (pinned to 58e5313667)