# Git "could not read Username" with no terminal in CI

> Fix the Git "could not read Username ... No such device or address" error in CI, caused by Git prompting for credentials with no terminal attached.

Source: https://latchkey.dev/learn/git/git-could-not-read-username-no-terminal-in-ci  
Updated: 2026-06-26

Git had no credential to use and tried to prompt for one, but CI has no interactive terminal, so the read fails immediately. The real problem is that no token or helper was configured.

## 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" with no terminal in CI?

There are 2 common causes: no credential configured for https and submodule url without credentials. No token in the URL, no credential helper, and no stored credential, so Git falls back to an interactive prompt that cannot run.

### How do I fix Git "could not read Username" with no terminal in CI?

There are 2 fixes depending on which cause you have: provide a non-interactive credential and rewrite auth for all github.com urls. Work through them in order, since the first is the most common.

### What does Git "could not read Username" with no terminal in CI actually mean?

A clone, fetch, or submodule update fails with fatal: could not read Username for the HTTPS remote: No such device or address.

### How do I stop Git "could not read Username" with no terminal in CI happening again?

Always configure an explicit token or credential helper for HTTPS Git in CI, and set GIT_TERMINAL_PROMPT=0 so missing credentials fail fast instead of stalling.

---

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
