Skip to content
Latchkey

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

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

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

  1. Scroll to the fatal:/remote: line right above the exit-128 summary.
  2. Fix that specific cause (token, ref, URL, ownership).
  3. 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.

Terminal
git config --global --add safe.directory "${{ github.workspace }}"

How to prevent it

  • 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.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →