{"record":{"id":"491b6f031784c300","repo":"dbt-labs/dbt-core","slug":"git-exited-with-status","errorCode":null,"errorMessage":"`git {}` exited with status {}","messagePattern":"`git (.+?)` exited with status (.+?)","errorType":"exception","errorClass":"anyhow","httpStatus":null,"severity":"error","filePath":"crates/dbt-ci/src/homebrew/publish.rs","lineNumber":179,"sourceCode":"        || url.starts_with(\"../\")\n}\n\nfn run_git(cwd: Option<&Path>, args: &[&str]) -> Result<()> {\n    let argv: Vec<OsString> = args.iter().map(|s| (*s).into()).collect();\n    run_git_os(cwd, &argv)\n}\n\nfn run_git_os(cwd: Option<&Path>, args: &[OsString]) -> Result<()> {\n    let mut cmd = Command::new(\"git\");\n    if let Some(d) = cwd {\n        cmd.current_dir(d);\n    }\n    cmd.args(args);\n    let status = cmd\n        .status()\n        .with_context(|| format!(\"spawn `git {}`\", display_argv(args)))?;\n    if !status.success() {\n        bail!(\n            \"`git {}` exited with status {}\",\n            display_argv(args),\n            status.code().unwrap_or(-1),\n        );\n    }\n    Ok(())\n}\n\nfn run_git_capture(cwd: Option<&Path>, args: &[&str]) -> Result<String> {\n    let mut cmd = Command::new(\"git\");\n    if let Some(d) = cwd {\n        cmd.current_dir(d);\n    }\n    cmd.args(args)\n        .stdout(Stdio::piped())\n        .stderr(Stdio::inherit());\n    let out = cmd\n        .output()","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-ci/src/homebrew/publish.rs#L161-L197","documentation":"run_git_os in crates/dbt-ci/src/homebrew/publish.rs spawns a `git` subprocess and bails when it exits with a non-zero status, embedding the full argument list and the exit code in the message. This is the generic wrapper for any git command invoked during the Homebrew publish flow (clone, branch, commit, push, etc.). The underlying failure cause is whatever git printed to stderr before exiting.","triggerScenarios":"Any git invocation via run_git_os during publish returning non-zero: pushing to a repository with bad/stale credentials, cloning a tap URL that does not exist, committing with a git identity that is not configured, network failure during push/fetch, or git not accepting the https.extraHeader auth prefix.","commonSituations":"GitHub token lacking `repo` scope so `git push` is rejected; tap repository renamed or deleted; HTTPS URL used without a valid token causing 403; expired credentials; corporate proxy blocking github.com; missing user.name/user.email for commit.","solutions":["Re-run with git stderr visible (it is inherited) and read the actual git error line immediately above this message.","Verify the auth token: check scope and expiry; for pushes to GitHub the token needs write access to the tap repository.","Confirm the tap repo URL/branch is correct and exists.","Configure git identity (`git config --global user.name/user.email`) if the failure is on commit.","If on a network-restricted CI runner, check proxy/DNS connectivity to the git host."],"exampleFix":"// before (token without push scope)\nenv::set_var(\"HOMEBREW_GITHUB_TOKEN\", read_only_token);\n\n// after (use a token with repo write access)\nenv::set_var(\"HOMEBREW_GITHUB_TOKEN\", token_with_repo_write_scope);","handlingStrategy":"try-catch","validationCode":"// pre-check git connectivity/auth before publishing\nlet ok = std::process::Command::new(\"git\")\n    .args([\"ls-remote\", &repo_url])\n    .status()\n    .map(|s| s.success())\n    .unwrap_or(false);\nif !ok { eprintln!(\"git cannot access {repo_url}; fix auth/URL before publish\"); }","typeGuard":null,"tryCatchPattern":"// the error message embeds args + exit code; surface stderr alongside\nmatch publish() {\n    Err(e) if e.to_string().contains(\"exited with status\") => {\n        eprintln!(\"git failed: {e:#}; see stderr above for git's own message\");\n    }\n    Err(e) => return Err(e),\n    Ok(v) => v,\n}","preventionTips":["Verify token scope/expiry before starting the publish pipeline.","Pre-flight `git ls-remote` against the tap repo to validate URL and credentials.","Configure git user.name/user.email in CI containers.","Keep git installed and updated on CI runners."],"tags":["git","subprocess","ci","homebrew","nonzero-exit"],"backgroundTag":"git-command-failed","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}