Could Not Read Username
fatal: could not read Username for - terminal prompts disabled - no credential for a private or missing repository, or for a push.
Could Not Read Username
Symptom
fatal: could not read Username for 'https://<INSTANCE>.git.eu': terminal prompts disabled
Cause
The server asked for a credential, git had none, and it could not prompt you (a CI job, a script, an IDE, or GIT_TERMINAL_PROMPT=0).
- The repository is private: reading it needs a credential.
- The repository does not exist. An anonymous client gets the same answer for a missing and for a private repository, so git.eu never tells who can see what.
- You push: every push needs a credential, even to a public repository.
Diagnose
1. Check the remote URL for a typo in the owner or repository name:
git remote -v
2. Check whether a credential helper is configured:
git config --get-all credential.helper
No output means git has nowhere to read a stored credential from.
Fix
Option A - Give the job a token (recommended for CI and scripts)
Create a personal access token with the Git access scope, store it as a CI secret, and pass it to git from that secret, for example in the URL (GITEU_TOKEN is the secret variable):
git clone "https://<USERNAME>:${GITEU_TOKEN}@<INSTANCE>.git.eu/<USERNAME>/<REPO>.git"
.git/config and in error output. Prefer a credential helper where the CI system offers one.
Option B - Configure a credential helper (interactive use)
Set up the OAuth helper or a token cache once: see Git Access (OAuth-PAT) and Clone and Push over HTTPS.
Verify
git ls-remote https://<INSTANCE>.git.eu/<USERNAME>/<REPO>.git
It lists the branches and tags, with no prompt.
Prevent
- Give every CI job that clones a private repository or pushes its own token, from a secret.
- Copy the clone URL from the repository page instead of typing it.