zeroclaw-labs/zeroclaw · error · anyhow::Error

Git clone failed: {stderr}

Error message

Git clone failed: {stderr}

What it means

install_git_skill_source shells out to 'git clone --depth 1 <source>' inside the skills directory; git exited non-zero and its raw stderr is embedded in the message. The failure is git's own — unreachable host, repository not found, authentication required, proxy refusal — surfaced verbatim.

Source

Thrown at crates/zeroclaw-runtime/src/skills/mod.rs:2131

            let _ = std::fs::remove_dir_all(&dest);
            Err(err)
        }
    }
}

pub fn install_git_skill_source(
    source: &str,
    skills_path: &Path,
    allow_scripts: bool,
) -> Result<(PathBuf, usize)> {
    let before = snapshot_skill_children(skills_path)?;
    let output = std::process::Command::new("git")
        .args(["clone", "--depth", "1", source])
        .current_dir(skills_path)
        .output()?;
    if !output.status.success() {
        let stderr = String::from_utf8_lossy(&output.stderr);
        anyhow::bail!("Git clone failed: {stderr}");
    }

    let installed_dir = detect_newly_installed_directory(skills_path, &before)?;
    remove_git_metadata(&installed_dir)?;
    match enforce_skill_security_audit(&installed_dir, allow_scripts) {
        Ok(report) => Ok((installed_dir, report.files_scanned)),
        Err(err) => {
            let _ = std::fs::remove_dir_all(&installed_dir);
            Err(err)
        }
    }
}

// ─── Skills registry resolution ───────────────────────────────────────────────

pub fn is_registry_source(source: &str) -> bool {
    if source.is_empty() {
        return false;

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Run 'git clone --depth 1 <url>' manually to see the exact git failure
  2. Fix the URL or credentials (SSH keys, personal access token, or switch to HTTPS)
  3. Verify network/proxy reachability of the git host from this machine
  4. If the server cannot serve shallow clones, host or point at a mirror that can
Defensive patterns

Strategy: try-catch

Validate before calling

// Cheap pre-flight: the remote must at least be reachable
let ok = std::process::Command::new("git")
    .args(["ls-remote", "--exit-code", source])
    .output()
    .map(|o| o.status.success())
    .unwrap_or(false);
if !ok {
    anyhow::bail!("git cannot reach {source}; check URL, credentials, network");
}

Try / catch

match install_git_skill_source(url, &skills_path, allow_scripts) {
    Err(e) if e.to_string().starts_with("Git clone failed:") => {
        // the remainder is git's own stderr: surface it, check URL/auth/proxy,
        // optionally retry once for transient network failures
    }
    r => r,
}

Prevention

When it happens

Trigger: 404 repo URL; private repository without credentials; DNS/network failure; misconfigured proxy; servers that reject shallow clones (--depth 1).

Common situations: Corporate proxies blocking the git host; typo'd git URL; SSH remote without keys; HTTPS remote requiring a PAT; air-gapped machines.

Related errors


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/899a9d471ef92ff6. Report an issue: GitHub.