{"record":{"id":"6b55977f07e8c4af","repo":"zed-industries/zed","slug":"git-clone-failed","errorCode":null,"errorMessage":"git clone failed: {}","messagePattern":"git clone failed: (.+?)","errorType":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/fs/src/fs.rs","lineNumber":1294,"sourceCode":"        let mut child = new_command(\"git\")\n            .current_dir(abs_work_directory)\n            .args([\"clone\", \"--progress\", repo_url])\n            .stdout(Stdio::null())\n            .stderr(Stdio::piped())\n            .kill_on_drop(true)\n            .spawn()?;\n        let stderr = child\n            .stderr\n            .take()\n            .context(\"failed to read git clone progress\")?;\n        let stderr_output = git_clone_progress::read(stderr, |message| {\n            job_tracker.update(message.into());\n        })\n        .await?;\n        let status = child.status().await?;\n\n        if !status.success() {\n            anyhow::bail!(\n                \"git clone failed: {}\",\n                git_clone_progress::failure_message(&stderr_output)\n            );\n        }\n\n        Ok(())\n    }\n\n    /// Runs `git config` with the given arguments.\n    /// Will return `Ok` if the commands exit status is `0`, with the stdout\n    /// contents. Otherwise returns `Err` with the stderr contents.\n    async fn git_config(&self, abs_work_directory: &Path, args: Vec<String>) -> Result<String> {\n        let output = new_command(\"git\")\n            .current_dir(abs_work_directory)\n            .args([String::from(\"config\")].into_iter().chain(args))\n            .output()\n            .await?;\n","sourceCodeStart":1276,"sourceCodeEnd":1312,"githubUrl":"https://github.com/zed-industries/zed/blob/9d272b036335401f339d024ea94968fd51016c40/crates/fs/src/fs.rs#L1276-L1312","documentation":"RealFs::clone_file shells out to `git clone <repo_url>` inside the working directory and, when the child exits non-zero, bails with \"git clone failed:\" plus git's trimmed stderr. The error text is whatever git itself printed — it is the authoritative reason (auth, DNS, repository not found). The call runs through new_command(\"git\"), so PATH resolution of git also matters for the preceding ? error, though this specific bail means git ran and failed.","triggerScenarios":"fs.clone_file(work_dir, repo_url) where `git clone` exits non-zero: nonexistent/private repo, missing credentials, no network, proxy/DNS failure, or a corrupted existing directory.","commonSituations":"Cloning template repositories on first run (no cached credentials yet), corporate proxies rejecting git:// or https, typos in repo_url, or SSH remotes without keys in the app's environment.","solutions":["Run `git clone <repo_url>` manually in a terminal and read the real stderr; fix auth (credential helper, SSH key, PAT) or the URL","For HTTPS behind a proxy, ensure git's http.proxy / env is visible to the app's process","Retry transient network failures after confirming connectivity","If the target directory is half-cloned from a previous failure, clean it before retrying"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match fs.clone_file(&dir, repo_url).await {\n    Ok(()) => Ok(()),\n    Err(e) if e.to_string().contains(\"git clone failed\") => {\n        // stderr text after the colon is git's own reason: act on auth/network/URL\n        Err(anyhow!(\"clone failed, run `git clone {repo_url}` manually: {e}\"))\n    }\n    Err(e) => Err(e),\n}","preventionTips":["Ensure git credentials (helper/SSH agent) are available to the app's environment before first clone","Validate repo_url reachability early; clean partially-cloned directories before retrying"],"tags":["git","clone","network","filesystem","zed-fs"],"backgroundTag":"git-clone-failed","analyzedSha":"9d272b036335401f339d024ea94968fd51016c40","analyzedAt":"2026-09-05T10:33:00.413Z","contentChangedAt":"2026-09-05T10:33:00.413Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}