{"record":{"id":"720c101e50da0284","repo":"gitbutlerapp/gitbutler","slug":"neither-found-push-remote-found-in-workspace-nor-u","errorCode":null,"errorMessage":"Neither found push remote found in workspace nor unambiguously in the Git repository configuration.","messagePattern":"Neither found push remote found in workspace nor unambiguously in the Git repository configuration\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/legacy/setup.rs","lineNumber":575,"sourceCode":"    // The workspace graph built from gitbutler/edit doesn't expose the target ref or\n    // remote configuration, but both are still configured in virtual_branches.toml\n    // and will be accessible when returning to gitbutler/workspace.\n    if head_name == b\"gitbutler/edit\" {\n        return Ok(true);\n    }\n\n    // TODO(legacy): it's fine to have no target.\n    if ws.graph.project_meta.target_ref.is_none() {\n        anyhow::bail!(\"No default target branch set.\");\n    }\n\n    // check if there is a remote\n    if ws.push_remote_name().is_none()\n        && repo\n            .remote_default_name(gix::remote::Direction::Push)\n            .is_none()\n    {\n        anyhow::bail!(\n            \"Neither found push remote found in workspace nor unambiguously in the Git repository configuration.\"\n        )\n    };\n\n    Ok(true)\n}\n\n/// Creates a 'gb-local' remote pointing to this repository and creates tracking refs for the default branch.\nfn setup_local_remote(repo: &gix::Repository, out: &mut OutputChannel) -> anyhow::Result<String> {\n    let t = theme::get();\n    let repo_url = repo\n        .workdir()\n        .ok_or_else(|| anyhow::anyhow!(\"Repository has no working directory\"))?\n        .to_str()\n        .ok_or_else(|| anyhow::anyhow!(\"Repository path is not valid UTF-8\"))?;\n\n    if let Some(out) = out.for_human() {\n        writeln!(","sourceCodeStart":557,"sourceCodeEnd":593,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/legacy/setup.rs#L557-L593","documentation":"`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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\n$ git remote -v   # empty or fetch-only\n// after\n$ git remote add origin git@github.com:me/repo.git\n$ git config remote.pushDefault origin","handlingStrategy":"validation","validationCode":"let has_remote = std::process::Command::new(\"git\")\n    .args([\"config\", \"remote.pushDefault\"])\n    .output()\n    .map(|o| !o.stdout.is_empty())\n    .unwrap_or(false);\nif !has_remote {\n    eprintln!(\"configure a push remote: git remote add origin <url> and/or git config remote.pushDefault origin\");\n    std::process::exit(1);\n}","typeGuard":"fn has_push_remote(ws: &Workspace) -> bool {\n    ws.push_remote_name().is_some()\n}","tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"push remote\") => {\n        // guide user to `git remote add` / `git config remote.pushDefault`\n    }\n    Err(e) => return Err(e),\n    Ok(v) => v,\n}","preventionTips":["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"],"tags":["git","remote","config","cli"],"backgroundTag":"missing-required-config","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}