{"record":{"id":"48264df7cb683fd6","repo":"nikivdev/code","slug":"could-not-determine-repo-name-use-repo","errorCode":null,"errorMessage":"could not determine repo name (use --repo)","messagePattern":"could not determine repo name \\(use --repo\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/push.rs","lineNumber":39,"sourceCode":"    let current_branch = current_branch(&repo_root)?;\n\n    let upstream_url = git_capture_in(&repo_root, &[\"remote\", \"get-url\", \"upstream\"])\n        .ok()\n        .map(|s| s.trim().to_string())\n        .filter(|s| !s.is_empty());\n    let origin_url = git_capture_in(&repo_root, &[\"remote\", \"get-url\", \"origin\"])\n        .ok()\n        .map(|s| s.trim().to_string())\n        .filter(|s| !s.is_empty());\n\n    let owner = resolve_push_owner(cmd.owner.as_deref())?;\n    let repo_name = if let Some(repo) = cmd.repo.as_deref() {\n        repo.trim().to_string()\n    } else {\n        derive_repo_name(&repo_root, upstream_url.as_deref(), origin_url.as_deref())?\n    };\n    if repo_name.is_empty() {\n        bail!(\"could not determine repo name (use --repo)\");\n    }\n\n    let target_url = choose_github_remote_url(&owner, &repo_name, &cmd)?;\n\n    if cmd.dry_run {\n        println!(\"Repo: {}\", repo_root.display());\n        println!(\"Branch: {}\", current_branch);\n        println!(\"Remote: {}\", cmd.remote);\n        println!(\"Target: {}\", target_url);\n        return Ok(());\n    }\n\n    ensure_remote_points_to_target(\n        &repo_root,\n        &cmd.remote,\n        &target_url,\n        upstream_url.as_deref(),\n        cmd.force,","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/push.rs#L21-L57","documentation":"run_mirror_push resolves the target repo name from --repo, or by deriving it from the repo root directory and upstream/origin remote URLs. If every source yields an empty string, it bails asking for --repo. Without a name, the tool cannot construct the fork's GitHub URL.","triggerScenarios":"No --repo flag, and derive_repo_name returns empty: the directory basename is unusable and neither the `upstream` nor `origin` remote URL exists or parses to a repo name (e.g. remotes unset or pointing at non-GitHub URLs).","commonSituations":"Forked repos cloned without remotes (downloaded zip → git init); origin pointing to a bare SSH alias the parser doesn't recognize; running in a repo whose folder name is empty/unexpected; CI checkouts where remotes were stripped.","solutions":["Pass --repo <name> explicitly","Set a parseable remote: `git remote add upstream <github-url>` (or fix origin) so the name can be derived","Ensure origin/upstream URLs are standard GitHub forms (git@github.com:owner/name.git or https://github.com/owner/name)"],"exampleFix":"// before\nf push  ->  could not determine repo name\n// after\nf push --repo my-fork-name\n# or\ngit remote add upstream https://github.com/original/original.git","handlingStrategy":"validation","validationCode":"let url = std::process::Command::new(\"git\")\n    .args([\"remote\",\"get-url\",\"origin\"]).output().ok();\nlet has_name = url.map(|o| o.status.success() && !o.stdout.is_empty()).unwrap_or(false);\nif !has_name {\n    eprintln!(\"pass --repo <name> or add a GitHub origin/upstream remote\");\n    std::process::exit(1);\n}","typeGuard":null,"tryCatchPattern":"match run_push(cmd) {\n    Err(e) if e.to_string().contains(\"could not determine repo name\") => {\n        eprintln!(\"add --repo <name> or set a parseable GitHub remote\");\n    }\n    other => other?,\n}","preventionTips":["Always pass --repo in scripted/CI runs","Keep origin or upstream pointing at standard GitHub URL forms","Don't strip remotes from CI checkouts (clone, don't download archives)"],"tags":["git","configuration","missing-argument","github"],"backgroundTag":"missing-required-config","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}