Git "fatal: could not read Username" - No Credential in CI
By Kaveh Alemi·Latchkey
Git needed a username for an HTTPS operation, had no credential helper or token to provide one, and could not prompt because CI has no terminal. With prompts disabled it fails immediately rather than hanging.
What this error means
An HTTPS clone/fetch/push fails with fatal: could not read Username for 'https://github.com': terminal prompts disabled. No token or credential helper is configured for the operation.
git output
fatal: could not read Username for 'https://github.com': terminal prompts
disabled
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
No credential supplied for the HTTPS remote
The job never injected a token or configured a credential helper, so Git has no username/password and falls back to a prompt it cannot show.
Cross-repo operation without a token
The default workflow auth covers the current repo; a clone/push to another repo needs an explicit token that was not provided.
How to fix it
Embed a token in the remote URL
Authenticate non-interactively with an installation token (x-access-token) or a PAT.
Always inject a token or configure a credential helper for HTTPS in CI.
Provide an explicit token for cross-repo clones/pushes.
Keep GIT_TERMINAL_PROMPT=0 so missing creds fail fast, not hang.
Frequently asked questions
What causes Git "fatal: could not read Username"?
There are 2 common causes: no credential supplied for the https remote and cross-repo operation without a token. The job never injected a token or configured a credential helper, so Git has no username/password and falls back to a prompt it cannot show.
How do I fix Git "fatal: could not read Username"?
There are 3 fixes depending on which cause you have: embed a token in the remote url, rewrite the host to carry the token, and or let actions/checkout configure auth. Work through them in order, since the first is the most common.
What does Git "fatal: could not read Username" actually mean?
An HTTPS clone/fetch/push fails with fatal: could not read Username for 'https://github.com': terminal prompts disabled.
How do I stop Git "fatal: could not read Username" happening again?
Always inject a token or configure a credential helper for HTTPS in CI. The prevention section lists 3 changes that keep it from recurring.