Git "could not read Username" - Credential Helper Hangs in CI
By Kaveh Alemi·Latchkey
Git needed a username/password and tried to prompt for it, but a CI runner has no interactive terminal. With no credential helper supplying the value, the prompt fails instantly instead of hanging forever.
What this error means
An HTTPS operation fails with fatal: could not read Username for 'https://github.com': No such device or address (or terminal prompts disabled). No credential helper or token is configured, so Git has nothing to authenticate with.
git output
fatal: could not read Username for 'https://github.com': No such device or
address
# or, with prompts disabled:
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 helper and no TTY
Git falls back to an interactive prompt when no helper provides credentials. In CI there is no terminal, so the prompt cannot be answered and the command fails.
Credentials never injected into the helper
A credential helper is configured but nothing populated it, so it returns empty and Git still has no username/password to use.
How to fix it
Supply credentials non-interactively
Provide a token via the URL or a credential helper so Git never needs to prompt.
Disable interactive prompts so a missing credential errors immediately rather than stalling the job.
Terminal
export GIT_TERMINAL_PROMPT=0
How to prevent it
Always inject a token or configure a credential helper in CI.
Set GIT_TERMINAL_PROMPT=0 so missing creds fail fast, not hang.
Prefer the checkout action’s built-in credential wiring.
Frequently asked questions
What causes Git "could not read Username"?
There are 2 common causes: no credential helper and no tty and credentials never injected into the helper. Git falls back to an interactive prompt when no helper provides credentials.
How do I fix Git "could not read Username"?
There are 3 fixes depending on which cause you have: supply credentials non-interactively, use the checkout action or insteadof rewrite, and fail fast instead of hanging. Work through them in order, since the first is the most common.
What does Git "could not read Username" actually mean?
An HTTPS operation fails with fatal: could not read Username for 'https://github.com': No such device or address (or terminal prompts disabled).
How do I stop Git "could not read Username" happening again?
Always inject a token or configure a credential helper in CI. The prevention section lists 3 changes that keep it from recurring.