# actions/checkout "git failed with exit code 128" in CI

> Fix "The process '/usr/bin/git' failed with exit code 128" from actions/checkout in CI - a generic git fatal error; the real cause is the fatal line above it.

Source: https://latchkey.dev/learn/git/gcs-git-process-failed-exit-code-128-in-ci  
Updated: 2026-06-30

Exit code 128 is git's generic "fatal error" code, not a specific problem. actions/checkout surfaces it when any git subprocess dies. The actionable message is the `fatal:` or `remote:` line printed just above this summary.

## Diagnose it: depth, refs, or credentials?

```Terminal
git rev-parse --is-shallow-repository
git rev-parse --abbrev-ref HEAD    # prints HEAD when detached
git log --oneline -3
git remote -v
```

> `actions/checkout` fetches depth 1 on a detached HEAD. Anything diffing against a base, reading a branch name, or running `git describe` needs `fetch-depth: 0`.

## FAQ

### What causes actions/checkout "git failed with exit code 128" in CI?

There are 2 common causes: a specific git fatal is the true cause and a dubious-ownership safe.directory error. Exit 128 accompanies many faults: missing token, repo not found, bad ref, dubious ownership.

### How do I fix actions/checkout "git failed with exit code 128" in CI?

There are 2 fixes depending on which cause you have: read the fatal line and fix that cause and mark the workspace as safe for dubious ownership. Work through them in order, since the first is the most common.

### What does actions/checkout "git failed with exit code 128" in CI actually mean?

The checkout step ends with "The process '/usr/bin/git' failed with exit code 128".

### How do I stop actions/checkout "git failed with exit code 128" in CI happening again?

Treat exit 128 as a pointer to the fatal line above, not a cause itself. The prevention section lists 3 changes that keep it from recurring.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
