zed-industries/zed · error
git status command failed
Error message
git status command failed
What it means
Thrown by `check_git_clean` (tooling/xtask/src/tasks/gpui.rs:317) when the spawned `git status --porcelain` command exits unsuccessfully. The publish flow needs a clean working tree to safely mutate manifests and commit release changes, so it first verifies git itself reports a clean state and aborts if git fails.
Solutions
- Run `git status --porcelain` manually to see git's underlying error and fix it (init/clone the repo, fix config, correct GIT_DIR).
- Run the publish command from within the actual git checkout of the repository.
- Check git installation and permissions (`which git; git --version`), then retry.
- Clear stray GIT_DIR/GIT_WORK_TREE environment variables that may point git at the wrong location.
Example fix
// before (exported tarball, no .git) cd extracted-source cargo xtask publish-gpui // after git clone git@github.com:zed-industries/zed.git cd zed cargo xtask publish-gpui
Defensive patterns
Strategy: try-catch
Validate before calling
let output = std::process::Command::new("git").args(["status", "--porcelain"]).output()?;
if !output.status.success() {
eprintln!("git failed: {}", String::from_utf8_lossy(&output.stderr));
} Try / catch
match Command::new("git").args(["status", "--porcelain"]).output() {
Ok(o) if o.status.success() => { /* proceed */ }
Ok(o) => eprintln!("git status failed: {}", String::from_utf8_lossy(&o.stderr)),
Err(e) => eprintln!("could not run git: {e}"),
} Prevention
- Always run publish from a proper git clone, not an exported tarball.
- Run `git status --porcelain` manually first to surface git config/environment problems.
- Unset stray GIT_DIR/GIT_WORK_TREE variables in publish scripts.
When it happens
Trigger: git is unavailable or fails in the current directory (not a git repo, corrupt .git, bad gitconfig, permission issues) so `git status --porcelain` returns a non-zero status during run_publish_gpui.
Common situations: Running xtask outside a git clone (e.g. an exported source tarball); a broken GIT_DIR/GIT_WORK_TREE environment; git hooks/config errors; a detached or inaccessible .git directory.
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
- Working directory is not clean. Please commit or stash your…
- Cargo.toml not found in current directory. Please run this…
- Command failed with status
- failed to generate evaluation example for commit
- failed to generate evaluation example for commit
AI-assisted analysis of zed-industries/zed@916fc2b8cb (2026-09-19).
Data as JSON: /api/errors/f896b99774c0f0e0.
Report an issue: GitHub.
Appendix: source
Thrown at tooling/xtask/src/tasks/gpui.rs:317
if !contents.contains("[workspace]") {
bail!(
"Current directory does not appear to be a workspace root. Please run this command from the workspace root."
);
}
Ok(())
}
fn check_git_clean() -> Result<()> {
let output = run_command(
Command::new("git")
.args(["status", "--porcelain"])
.stdout(Stdio::piped())
.stderr(Stdio::piped()),
)?;
if !output.status.success() {
bail!("git status command failed");
}
let stdout = String::from_utf8_lossy(&output.stdout);
if !stdout.trim().is_empty() {
bail!(
"Working directory is not clean. Please commit or stash your changes before publishing."
);
}
Ok(())
}
fn run_command(command: &mut Command) -> Result<Output> {
let command_str = {
let program = command.get_program().to_string_lossy();
let args = command
.get_args()
.map(|arg| arg.to_string_lossy())View on GitHub (pinned to 916fc2b8cb)