{"record":{"id":"cd8bc719008a538b","repo":"gitbutlerapp/gitbutler","slug":"no-push-remotes-found","errorCode":null,"errorMessage":"No push remotes found","messagePattern":"No push remotes found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/gitbutler-project/src/gerrit.rs","lineNumber":10,"sourceCode":"/// Check if the default remote of the repository is using Gerrit.\npub fn is_used_by_default_remote(repo: &gix::Repository) -> anyhow::Result<bool> {\n    use gix::{bstr::ByteSlice, remote::Direction};\n\n    // Magic refspec that we use to determine if the remote is a Gerrit remote\n    let gerrit_notes_ref = \"refs/meta/config\";\n\n    let remote_name = repo\n        .remote_default_name(Direction::Push)\n        .ok_or_else(|| anyhow::anyhow!(\"No push remotes found\"))?;\n\n    let mut remote = repo.find_remote(remote_name.as_bstr())?;\n    // Need to set fetch specs as ref-map requests always use fetch specs (it's not used when pushing)\n    remote.replace_refspecs(vec![gerrit_notes_ref], Direction::Fetch)?;\n\n    let (map, _) = remote\n        .with_fetch_tags(gix::remote::fetch::Tags::None)\n        .connect(Direction::Push)?\n        .ref_map(gix::progress::Discard, Default::default())?;\n\n    Ok(!map.remote_refs.is_empty())\n}\n","sourceCodeStart":1,"sourceCodeEnd":23,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/gitbutler-project/src/gerrit.rs#L1-L23","documentation":"is_used_by_default_remote detects whether the project's default push remote is a Gerrit server by probing the magic `refs/meta/config` refspec. If the repository has no default push remote configured, remote_default_name(Direction::Push) returns None and this error is thrown. It is an inherent part of the gerrit detection check rather than an unexpected failure.","triggerScenarios":"Calling is_used_by_default_remote on a repo with no `origin`-style remote, or where the remote exists only with a fetch (not push) URL configured.","commonSituations":"Freshly cloned-less local repos, repos set up for fetch-only mirrors, repos where the user only configured `remote.<name>.fetchurl`, or projects cloned without any remote.","solutions":["Add a push remote: `git remote add origin <url>` and set `git push --set-upstream origin <branch>` once.","If a remote exists, ensure it has a push URL: `git remote set-url --push origin <url>`.","Verify with `git remote -v` that a push entry is listed before re-running the check.","If Gerrit detection is irrelevant for this repo, skip calling this check for remote-less repositories."],"exampleFix":"// before\nlet is_gerrit = gerrit::is_used_by_default_remote(&repo)?;\n// after\nlet is_gerrit = match repo.remote_default_name(git2::Direction::Push) {\n    Some(_) => gerrit::is_used_by_default_remote(&repo).unwrap_or(false),\n    None => false,\n};","handlingStrategy":"fallback","validationCode":"let has_push_remote = repo\n    .remotes()?\n    .iter()\n    .flatten()\n    .any(|name| {\n        repo.find_remote(name)\n            .ok()\n            .and_then(|r| r.pushurl().map(|s| !s.is_empty()).or(Some(true)))\n            .unwrap_or(false)\n    });","typeGuard":null,"tryCatchPattern":"let is_gerrit = match gerrit::is_used_by_default_remote(&repo) {\n    Ok(v) => v,\n    Err(e) if e.to_string().contains(\"No push remotes\") => false,\n    Err(e) => return Err(e),\n};","preventionTips":["Always configure a push remote (`git remote add origin <url>`) before relying on remote-dependent features.","Check `git remote -v` shows a push entry, not just fetch.","Treat remote-less repos as non-Gerrit in calling code."],"tags":["git","remote","gerrit","configuration"],"backgroundTag":"resource-not-found","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"}