astral-sh/ruff · error
Git clone failed: {}
Error message
Git clone failed: {} What it means
The benchmark harness clones real-world projects on first use (blob-filtered, no checkout); if `git clone` exits nonzero this error is raised with git's stderr.
Source
Thrown at crates/ruff_benchmark/src/real_world_projects.rs:218
fn clone_repository(repo_url: &str, target_dir: &Path, commit: &str) -> Result<()> {
// Create parent directory if it doesn't exist
if let Some(parent) = target_dir.parent() {
std::fs::create_dir_all(parent).context("Failed to create parent directory for clone")?;
}
// Clone with minimal depth and fetch only the specific commit
let output = Command::new("git")
.args([
"clone",
"--filter=blob:none", // Don't download large files initially
"--no-checkout", // Don't checkout files yet
repo_url,
target_dir.to_str().unwrap(),
])
.output()
.context("Failed to execute git clone command")?;
anyhow::ensure!(
output.status.success(),
"Git clone failed: {}",
String::from_utf8_lossy(&output.stderr)
);
// Fetch the specific commit
let output = Command::new("git")
.args(["fetch", "origin", commit])
.current_dir(target_dir)
.output()
.context("Failed to execute git fetch command")?;
anyhow::ensure!(
output.status.success(),
"Git fetch of commit {} failed: {}",
commit,
String::from_utf8_lossy(&output.stderr)
);View on GitHub (pinned to 672bb4edf0)
Solutions
- Read the embedded git stderr to identify network vs repository vs disk failure
- Verify the repo URL is reachable: `git ls-remote <repo_url> HEAD`
- Free disk space under target/ if the clone ran out of room, then rerun
- Retry after transient network failures; the clone is retried on the next run
Example fix
# before bench run fails with: Git clone failed: fatal: unable to access ... # after git ls-remote <repo_url> HEAD && cargo bench --bench <real-world-bench>
Defensive patterns
Strategy: retry
Validate before calling
git ls-remote "$repo_url" HEAD >/dev/null 2>&1 || {
echo "cannot reach $repo_url — check network/proxy" >&2
exit 1
}
df -h target | tail -1 # ensure headroom before a multi-repo clone Try / catch
for i in 1 2 3; do cargo bench --bench "$bench" && break echo "clone attempt $i failed; retrying" >&2 rm -rf "target/benchmark_cache/$project" sleep 5 done
Prevention
- Pre-clone benchmark repos in a warm-up CI step with retries
- Keep target/ on a volume with free space for several filtered clones
- Verify repo URLs still resolve when updating the benchmark suite
When it happens
Trigger: First `cargo bench` run of a real-world project when cloning fails: network unreachable, proxy blocking https git, repository moved or made private, or insufficient disk space.
Common situations: Air-gapped or proxied CI environments; disk pressure under target/; upstream repos relocated since the benchmark table was written.
Related errors
- Git fetch of commit {} failed: {}
- Git checkout of commit {} failed: {}
- Dependency installation failed: {}
- Failed to fetch playground ${id}: ${response.status}
- Failed to save playground: ${response.status}
AI-assisted analysis of astral-sh/ruff@672bb4edf0 (2026-08-16).
Data as JSON: /api/errors/c6a948af1adc0166.
Report an issue: GitHub.