actions/checkout "git failed with exit code 128" in CI
By Kaveh Alemi·Latchkey
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.
What this error means
The checkout step ends with "The process '/usr/bin/git' failed with exit code 128". A fatal: line (auth, not found, bad ref, or safe.directory) appears immediately before it.
actions/checkout
fatal: could not read Username for 'https://github.com': terminal prompts disabled
The process '/usr/bin/git' failed with exit code 128
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
Common causes
A specific git fatal is the true cause
Exit 128 accompanies many faults: missing token, repo not found, bad ref, dubious ownership. The line above names which one.
A dubious-ownership safe.directory error
On self-hosted runners a workspace owned by a different user triggers "detected dubious ownership", which git returns as exit 128.
How to fix it
Read the fatal line and fix that cause
Scroll to the fatal:/remote: line right above the exit-128 summary.
Fix that specific cause (token, ref, URL, ownership).
Re-run the checkout.
Mark the workspace as safe for dubious ownership
If the fatal line is dubious ownership, add the path to safe.directory.
Treat exit 128 as a pointer to the fatal line above, not a cause itself.
On self-hosted runners, keep workspace ownership consistent.
Fix the specific auth/ref/URL fault the log names.
Frequently asked questions
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.