# Git "fatal: could not read Username" - No Credential in CI

> Fix Git "fatal: could not read Username for ...: terminal prompts disabled" in CI - no token or credential helper supplied, so Git has nothing to authenticate an HTTPS operation with.

Source: https://latchkey.dev/learn/git/git-could-not-read-username  
Updated: 2026-06-25

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.

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

---

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
