Skip to content
Latchkey

GitHub Actions "could not read Username" (token not passed to git)

A git command tried to authenticate interactively because no token was configured. In CI there is no prompt, so it fails. This is a setup issue, not transient.

What this error means

A git fetch, clone, or push fails with "could not read Username for https://github.com: terminal prompts disabled".

github-actions
fatal: could not read Username for 'https://github.com': terminal prompts disabled

Common causes

No credentials configured

Cloning a private repo or pushing without a token means git has no way to authenticate.

Manual git after checkout cleared credentials

Re-cloning a different repo, or disabling persist-credentials, removes the auth header.

How to fix it

Supply a token to git

  1. Pass a token to actions/checkout, or set an extraheader with a PAT.
  2. For private submodules or other repos, configure the URL with the token.
.github/workflows/ci.yml
- uses: actions/checkout@v4
  with:
    token: ${{ secrets.GITHUB_TOKEN }}

How to prevent it

  • Always provide a token when accessing private repositories.
  • Avoid disabling persist-credentials unless you re-add auth yourself.

Related guides

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