windmill-labs/windmill · error
Error getting git repo commit hash: {stderr}
Error message
Error getting git repo commit hash: {stderr} What it means
In clone_repo, after running `git rev-parse` (or similar) to get the repository commit hash, the command exited non-zero. The stderr is embedded so the underlying git failure (missing repo, auth failure, bad ref) is visible.
Source
Thrown at backend/windmill-worker/src/ansible_executor.rs:376
let mut rev_parse_cmd = Command::new(GIT_PATH.as_str());
let commit_hash_output = rev_parse_cmd
.current_dir(job_dir)
.env_clear()
.envs(PROXY_ENVS.clone())
.env("PATH", PATH_ENV.as_str())
.env("TZ", TZ_ENV.as_str())
.env("GIT_SSH_COMMAND", git_ssh_cmd)
.arg("-C")
.arg(&target_path)
.args(["rev-parse", "HEAD"])
.stderr(Stdio::piped())
.output()
.await?;
if !commit_hash_output.status.success() {
let stderr = String::from_utf8(commit_hash_output.stderr)?;
return Err(anyhow!("Error getting git repo commit hash: {stderr}").into());
}
let commit_hash = String::from_utf8(commit_hash_output.stdout)?
.trim()
.to_string();
Ok(commit_hash)
}
pub fn create_empty_dir(path: &PathBuf) -> std::io::Result<()> {
if path.exists() {
if path.is_dir() {
let mut entries = std::fs::read_dir(&path)?;
if entries.next().is_some() {
return Err(std::io::Error::new(
std::io::ErrorKind::AlreadyExists,
format!(
"Directory '{}' already exists and is not empty",View on GitHub (pinned to e474e8803c)
Solutions
- Read the stderr in the message — it names the git failure
- Verify the repo URL, branch/tag and credentials (deploy key or token) are correct
- Test `git ls-remote <url>` from the worker environment
- Ensure git is installed in the worker image and egress to the git host is allowed
Defensive patterns
Strategy: retry
Validate before calling
git ls-remote "$REPO_URL" "$BRANCH" >/dev/null 2>&1 || echo "repo/branch not reachable" command -v git >/dev/null || echo "git missing in worker image"
Try / catch
// retry transient git failures before failing the job
for attempt in 0..3 {
match clone_repo(...).await {
Err(e) if e.to_string().contains("commit hash") && attempt < 2 => {
tokio::time::sleep(Duration::from_secs(2u64.pow(attempt))).await;
}
other => { other?; break; }
}
} Prevention
- Verify repo URL/branch and deploy credentials before the job
- Test git access from the worker network (egress/proxy)
- Ensure git is installed in the worker image
- Pre-clone warm repos to surface auth issues early
When it happens
Trigger: Ansible job requires a git repo; the git command to read the commit hash fails — repo not cloned yet, wrong branch/tag, bad credentials, or git not installed in the worker image.
Common situations: Private repo without deploy key/token; repo URL typo; worker image missing git binary; network egress blocked from the worker.
Understand the failure class
Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.
Related errors
- failed to execute replace_ephemeral command: {}
- Failed to parse git repo: {e}
- Should be a Map
- Expected `url` field
- Expected `target` field (target directory for cloning the re
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/911da1ea2424f714.
Report an issue: GitHub.