Git "could not read Username" - Credential Helper Hangs in CI
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.
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 disabledCommon 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.
git config --global credential.helper store
printf "https://x-access-token:%s@github.com\n" "$GITHUB_TOKEN" > ~/.git-credentials
git clone https://github.com/org/repo.gitUse the checkout action or insteadOf rewrite
Let actions/checkout configure the credential, or rewrite the remote to carry the token.
git config --global url."https://x-access-token:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"Fail fast instead of hanging
Disable interactive prompts so a missing credential errors immediately rather than stalling the job.
export GIT_TERMINAL_PROMPT=0How to prevent it
- Always inject a token or configure a credential helper in CI.
- Set
GIT_TERMINAL_PROMPT=0so missing creds fail fast, not hang. - Prefer the checkout action’s built-in credential wiring.