{"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":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/legacy/setup.rs","lineNumber":525,"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.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":507,"sourceCodeEnd":543,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/legacy/setup.rs#L507-L543","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Add exactly one remote: `git remote add origin <url>`.","If multiple remotes are intentional, disambiguate with `git config remote.pushDefault origin` or `git config branch.<name>.pushRemote origin`.","Re-run `but setup` so the chosen remote is recorded in the workspace configuration."],"exampleFix":"# before\ngit remote -v   # (empty)\nbut status      # Neither found push remote found...\n\n# after\ngit remote add origin git@github.com:org/repo.git\nbut status","handlingStrategy":"validation","validationCode":"let has_remote = ws.remote_name().is_some()\n    || repo.remote_default_name(gix::remote::Direction::Push).is_some();\nif !has_remote {\n    anyhow::bail!(\"configure a push remote (git remote add origin <url>) first\");\n}","typeGuard":null,"tryCatchPattern":"match check_project_setup(&ctx, &perm) {\n    Err(err) if err.to_string().contains(\"push remote\") => {\n        // guide user: git remote add origin <url> or set remote.pushDefault\n    }\n    other => other,\n}","preventionTips":["Configure exactly one remote or set remote.pushDefault before running setup.","Re-run `but setup` after adding or changing remotes.","Verify with `git remote -v` and `git config remote.pushDefault` in CI or onboarding scripts."],"tags":["git","remote","push","git-config","setup"],"backgroundTag":"git-remote-not-configured","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}