{"record":{"id":"46376d512b5729f1","repo":"nikivdev/code","slug":"git-clone-failed","errorCode":null,"errorMessage":"git clone failed","messagePattern":"git clone failed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/repos.rs","lineNumber":93,"sourceCode":"        }\n    }\n\n    let clone_url = resolve_git_like_clone_url(&opts.url)?;\n    let mut cmd = Command::new(\"git\");\n    cmd.arg(\"clone\").arg(&clone_url);\n    if let Some(dir) = opts.directory {\n        cmd.arg(dir);\n    }\n\n    let status = cmd\n        .stdin(Stdio::inherit())\n        .stdout(Stdio::inherit())\n        .stderr(Stdio::inherit())\n        .status()\n        .context(\"failed to run git clone\")?;\n\n    if !status.success() {\n        bail!(\"git clone failed\");\n    }\n\n    Ok(())\n}\n\nfn open_in_zed(path: &std::path::Path) -> Result<()> {\n    let try_open = |app: &str| -> Result<()> {\n        let status = std::process::Command::new(\"open\")\n            .args([\"-a\", app])\n            .arg(path)\n            .status()\n            .with_context(|| format!(\"failed to open {app}\"))?;\n        if !status.success() {\n            bail!(\"{app} exited with status {status}\");\n        }\n        Ok(())\n    };\n","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/repos.rs#L75-L111","documentation":"clone_git_like runs `git clone` with inherited stdio and bails if the process exits non-zero. The generic message means git itself reported the failure; the actual cause (auth, network, bad URL) was already printed to the terminal via inherited stderr.","triggerScenarios":"`git clone` exits non-zero during a `f` clone (any git-level failure).","commonSituations":"Repository URL wrong or repo doesn't exist; SSH key not authorized for the remote; HTTPS token expired; network/DNS failure; target directory already exists and is non-empty; insufficient permissions on a private repo.","solutions":["Read the git output above the error for the exact cause","Verify the clone URL (try cloning with plain `git clone <url>` to reproduce)","For SSH: confirm access with `ssh -T git@host`; for HTTPS: refresh credentials/token","Ensure the destination directory doesn't already exist or is empty"],"exampleFix":"// before (typo)\nf clone git@github.com:org/repo.git  // repo doesn't exist\n// after\nf clone git@github.com:org/repo.git  // correct, existing repo","handlingStrategy":"retry","validationCode":"const { execSync } = require(\"child_process\");\nfunction canReachRemote(url) {\n  try { execSync(`git ls-remote ${url} HEAD`, { stdio: \"ignore\" }); return true; }\n  catch { return false; }\n}\nif (!canReachRemote(url)) throw new Error(`cannot access ${url}; fix URL/auth before cloning`);","typeGuard":null,"tryCatchPattern":"async function cloneWithRetry(url, dest, attempts = 2) {\n  for (let i = 0; i < attempts; i++) {\n    try { return run([\"f\", \"clone\", url, dest]); }\n    catch (e) {\n      if (i === attempts - 1) throw e;\n      await sleep(1000 * (i + 1)); // transient network failures only\n    }\n  }\n}","preventionTips":["Verify the repo URL and access with `git ls-remote <url>` before cloning","Keep SSH keys/HTTPS tokens authorized and unexpired for the remote host","Ensure the destination path is new or empty; check network/DNS before batch clones"],"tags":["git","clone","process-exit"],"backgroundTag":"git-clone-failed","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}