# Git "could not read Username" - Credential Helper Hangs in CI

> Fix Git "fatal: could not read Username for ...: No such device or address" in CI - a credential prompt with no TTY, or a missing/misconfigured credential helper.

Source: https://latchkey.dev/learn/git/git-credential-helper-ci  
Updated: 2026-06-25

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.

## 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
```

> `actions/checkout` fetches depth 1 on a detached HEAD. Anything diffing against a base, reading a branch name, or running `git describe` needs `fetch-depth: 0`.

## FAQ

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

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
