nikivdev/code · error

missing push remote for {}

Error message

missing push remote for {}

What it means

In DirectPush home-branch workflow mode the tool must know which git remote branches are pushed to. It calls resolve_push_remote_name; when that returns None (no resolvable push remote for the repository) it throws this error naming the repo path. It means the repo has no configured remote that can serve as a push target for this workflow.

Source

Thrown at src/repos.rs:1006

                    "ensure private mirror trunk {public_default_branch} and push {home_branch} to {}",
                    DEFAULT_FORK_REMOTE
                ));
                if !options.dry_run {
                    ensure_private_mirror(
                        repo_root,
                        &home_branch,
                        &public_default_branch,
                        options.quiet,
                    )?;
                }
                changed = true;
            }
        }
        HomeBranchWorkflowMode::PrivateMirror => {}
        HomeBranchWorkflowMode::DirectPush => {
            let push_remote = resolve_push_remote_name(repo_root, status.public_remote.as_deref())
                .ok_or_else(|| {
                    anyhow::anyhow!("missing push remote for {}", repo_root.display())
                })?;
            let needs_push_config = status.remote_push_default.as_deref()
                != Some(push_remote.as_str())
                || status.home_branch_push_remote.as_deref() != Some(push_remote.as_str())
                || status.default_branch_push_remote.as_deref() != Some(push_remote.as_str());

            if needs_push_config {
                steps.push(format!(
                    "set {home_branch} and {public_default_branch} push remote to {push_remote}"
                ));
                if !options.dry_run {
                    ensure_direct_push_remote(
                        repo_root,
                        &home_branch,
                        &public_default_branch,
                        &push_remote,
                        options.quiet,
                    )?;

View on GitHub (pinned to a747e741ae)

Solutions

  1. Add or fix a remote in the repo: git remote add origin <url> (or git remote set-url origin <url>).
  2. Configure the push remote explicitly so resolve_push_remote_name can find it (e.g. set the expected push remote / public_remote config the tool reads).
  3. Switch the repo's home-branch workflow mode away from DirectPush (e.g. PrivateMirror) if no push remote is intended.
  4. Verify with git remote -v that the repo actually has a fetch/push remote before re-running.

Example fix

// before: repo with no remote, DirectPush mode fails
$ git remote -v   # (empty)
// after
$ git remote add origin git@github.com:me/my-repo.git
$ git push -u origin main
Defensive patterns

Strategy: validation

Validate before calling

fn has_push_remote(repo_root: &Path) -> bool {
    let out = std::process::Command::new("git")
        .args(["-C", repo_root.to_str().unwrap(), "remote"])
        .output()
        .map(|o| o.stdout)
        .unwrap_or_default();
    !out.is_empty()
}
// call before the workflow; skip DirectPush mode if !has_push_remote(repo_root)

Type guard

fn is_direct_push_mode(mode: &HomeBranchWorkflowMode) -> bool {
    matches!(mode, HomeBranchWorkflowMode::DirectPush)
}

Try / catch

match ensure_home_branch_workflow(repo_root, &options) {
    Err(e) if e.to_string().contains("missing push remote") => {
        eprintln!("skipping {}: no push remote configured", repo_root.display());
    }
    Err(e) => return Err(e),
    Ok(_) => {}
}

Prevention

When it happens

Trigger: Running the home-branch setup/ensure flow against a repo whose workflow mode is DirectPush while the repo has no remotes at all, or resolve_push_remote_name cannot resolve one from status.public_remote or git config (e.g. origin missing or push.remoteName unset).

Common situations: Cloning a repo without remotes (fresh git init), running the tool in a bare/submodule checkout, renaming or deleting origin, or a config where public_remote is unset and no fallback remote exists.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/acd04a08a3dbc7e2. Report an issue: GitHub.