Skip to content
Latchkey

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.

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

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.

Terminal
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.git

Use the checkout action or insteadOf rewrite

Let actions/checkout configure the credential, or rewrite the remote to carry the token.

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

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.

Related guides

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