{"record":{"id":"acd04a08a3dbc7e2","repo":"nikivdev/code","slug":"missing-push-remote-for","errorCode":null,"errorMessage":"missing push remote for {}","messagePattern":"missing push remote for (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/repos.rs","lineNumber":1006,"sourceCode":"                    \"ensure private mirror trunk {public_default_branch} and push {home_branch} to {}\",\n                    DEFAULT_FORK_REMOTE\n                ));\n                if !options.dry_run {\n                    ensure_private_mirror(\n                        repo_root,\n                        &home_branch,\n                        &public_default_branch,\n                        options.quiet,\n                    )?;\n                }\n                changed = true;\n            }\n        }\n        HomeBranchWorkflowMode::PrivateMirror => {}\n        HomeBranchWorkflowMode::DirectPush => {\n            let push_remote = resolve_push_remote_name(repo_root, status.public_remote.as_deref())\n                .ok_or_else(|| {\n                    anyhow::anyhow!(\"missing push remote for {}\", repo_root.display())\n                })?;\n            let needs_push_config = status.remote_push_default.as_deref()\n                != Some(push_remote.as_str())\n                || status.home_branch_push_remote.as_deref() != Some(push_remote.as_str())\n                || status.default_branch_push_remote.as_deref() != Some(push_remote.as_str());\n\n            if needs_push_config {\n                steps.push(format!(\n                    \"set {home_branch} and {public_default_branch} push remote to {push_remote}\"\n                ));\n                if !options.dry_run {\n                    ensure_direct_push_remote(\n                        repo_root,\n                        &home_branch,\n                        &public_default_branch,\n                        &push_remote,\n                        options.quiet,\n                    )?;","sourceCodeStart":988,"sourceCodeEnd":1024,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/repos.rs#L988-L1024","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Add or fix a remote in the repo: git remote add origin <url> (or git remote set-url origin <url>).","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).","Switch the repo's home-branch workflow mode away from DirectPush (e.g. PrivateMirror) if no push remote is intended.","Verify with git remote -v that the repo actually has a fetch/push remote before re-running."],"exampleFix":"// before: repo with no remote, DirectPush mode fails\n$ git remote -v   # (empty)\n// after\n$ git remote add origin git@github.com:me/my-repo.git\n$ git push -u origin main","handlingStrategy":"validation","validationCode":"fn has_push_remote(repo_root: &Path) -> bool {\n    let out = std::process::Command::new(\"git\")\n        .args([\"-C\", repo_root.to_str().unwrap(), \"remote\"])\n        .output()\n        .map(|o| o.stdout)\n        .unwrap_or_default();\n    !out.is_empty()\n}\n// call before the workflow; skip DirectPush mode if !has_push_remote(repo_root)","typeGuard":"fn is_direct_push_mode(mode: &HomeBranchWorkflowMode) -> bool {\n    matches!(mode, HomeBranchWorkflowMode::DirectPush)\n}","tryCatchPattern":"match ensure_home_branch_workflow(repo_root, &options) {\n    Err(e) if e.to_string().contains(\"missing push remote\") => {\n        eprintln!(\"skipping {}: no push remote configured\", repo_root.display());\n    }\n    Err(e) => return Err(e),\n    Ok(_) => {}\n}","preventionTips":["Always create at least one git remote (origin) before enabling DirectPush workflow mode.","Run git remote -v as a preflight check in CI before running the workflow tooling.","Prefer PrivateMirror mode for repos that legitimately have no push remote.","Document remote naming conventions so resolve_push_remote_name can always find the expected remote."],"tags":["git","remote","configuration","workflow"],"backgroundTag":"missing-git-remote","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}