# How do I fix "could not read Username for 'https://github.com'" in GitHub Actions?

"could not read Username for 'https://github.com': terminal prompts disabled" means git had no credential GitHub accepted. Three causes, each with its fix.

By Grant Unwin, published 2026-11-20. Checked against GitHub's documentation on 2026-11-20. The web page: https://www.runners.io/blog/github-actions-could-not-read-username-terminal-prompts-disabled

“fatal: could not read Username for 'https://github.com': terminal prompts disabled” means git was refused by GitHub over HTTPS, tried to ask for a username, and was not allowed to prompt. git then exits with code 128. The request carried no credential, or one GitHub rejected: an expired, revoked or mistyped token, a tool that clones on its own, or a git command that never had the credential (`persist-credentials: false`, or another clone).

**In short**

- git was refused over HTTPS, wanted to ask for a username and may not prompt, so it exits with code 128.
- actions/checkout sets GIT\_TERMINAL\_PROMPT to 0 for its git commands, which gives this wording.
- The most confirmed cause is an expired, revoked or mistyped token passed to checkout.
- A valid token that cannot read a repository gets "Repository not found" instead, not this message.
- A later git command has no credential when persist-credentials is false or it runs outside the checkout.

The message is about the prompt, and the prompt is not the problem: a job has nobody to answer it. This post covers what git is doing when it prints the line, the causes in the order to check them, how to tell which one you have, and the fix for each.

## What does “could not read Username for 'https://github.com': terminal prompts disabled” mean?

When a server answers an HTTPS request with a demand for authentication and git has no credential to send, git asks for a username on the terminal. git’s documentation describes one variable that forbids this: `GIT_TERMINAL_PROMPT` set to false means git will not prompt, “e.g., when asking for HTTP authentication”. In git’s source the refusal is the literal text “terminal prompts disabled”, appended to “could not read Username for” and the server’s address. The checkout action sets that variable to 0 for every git command it runs, which is why this is the wording you see in a checkout step.

So read the message as “GitHub did not accept this request as authenticated”. I reproduced it both ways against a test server that refuses everything: once with no credential at all, and once with a credential sent as an authorisation header, the way checkout sends its token. git printed the same line each time.

## What causes it?

**1. The token passed to checkout is expired, revoked or mistyped.** A secret that is missing altogether fails earlier, with “Input required and not supplied: token”. This is the cause people confirm most on the checkout action’s issue for this message. The comment “the cause of the problem was that the token expired” has 29 thumbs-up, and later comments say to check that the secret exists under the name the workflow uses. The most-reacted comment, with 57, reports the opposite case: a personal access token created with no expiry date gave the same error for its author. Either way the first thing to check is the token itself.

A valid token that cannot read the repository, such as `github.token` for another private repository or a private submodule, gets “remote: Repository not found” instead. The checkout README says that token is scoped to the current repository, so a different private repository needs a token of your own. That is a different message, not this one.

**2. A later git command has no credential.** Checkout keeps its token in the repository’s git configuration so that your own `git fetch` or `git push` in later steps is authenticated, and removes it when the job ends. With `persist-credentials: false` it is never kept. A push from a second clone made by hand, or from another directory, has no token either. Since version 6 the token is held in a separate file, and the README says authenticated git commands from a Docker container action need runner 2.329.0 or later.

**3. A tool fetches a private repository over HTTPS.** A package manager that resolves a dependency from a private GitHub repository runs git itself, outside checkout, with whatever credentials the machine has. On a fresh runner that is none.

## How do I tell which one I have?

Look at which step printed the line. In a checkout step with a `token:` input, it is cause 1. In a `run` step, it is cause 2 when the command is your own git command and cause 3 when it is an install or build command. A checkout of another repository or of submodules that says “Repository not found” is a token that works but cannot read it, the note above. The address in the message is the server git was talking to, which settles any doubt about which host refused.

## How do I fix it?

For cause 1, and for the “Repository not found” case, give checkout a token that can read every repository it has to fetch, and make sure the secret is set and current. A personal access token or a GitHub App token stored as a secret both work; the README recommends the least access necessary.

```yaml
steps:
  - uses: actions/checkout@v4
    with:
      submodules: recursive
      token: ${{ secrets.REPO_READ_TOKEN }}   # can read this repository and its submodules
```

Check the secret’s name under Settings, Secrets and variables, Actions, against the name the workflow uses, and the token’s expiry where it was created. For an SSH deploy key instead of a token, pass `ssh-key`; the post on [“Permission denied (publickey)”](https://www.runners.io/blog/github-actions-permission-denied-publickey) covers that route’s own failure.

For cause 2, leave `persist-credentials` at its default in the job that pushes, and run your git commands inside the directory checkout created. For cause 3, tell git to send a token for GitHub addresses before the tool runs. A commenter on the same issue, with 9 thumbs-up, solved it by rewriting `https://github.com` to an address that carries the token:

```yaml
steps:
  - name: Let git read our private dependencies
    env:
      TOKEN: ${{ secrets.REPO_READ_TOKEN }}
    run: git config --global url."https://x-access-token:${TOKEN}@github.com/".insteadOf "https://github.com/"
  - run: go build ./...
```

Pass the token through `env`, as above, so it is not written into the script text. The [security hardening post](https://www.runners.io/blog/github-actions-security-hardening) explains why, and what scope such a token should have.

## What should I check before changing anything else?

Three quick ones. git exits 128, its code for a fatal error: a `run` step reports that code, and checkout logs “The process '/usr/bin/git' failed with exit code 128”. The [exit code post](https://www.runners.io/blog/github-actions-process-completed-with-exit-code-1) lists with the others. If the same workflow fails only for some pull requests, compare what token those runs receive: the post on [“Resource not accessible by integration”](https://www.runners.io/blog/github-actions-resource-not-accessible-by-integration) covers the read-only token given to forks. And the [checkout reference](https://www.runners.io/blog/actions-checkout-every-input-v4-to-v7) lists every input named here.

The token and the refusal are both GitHub’s, so this error is the same on any runner, ours included. Every size we run, with its memory, disk and rate a minute, is on our [managed GitHub Actions runners](https://www.runners.io/runners) page.

## Sources

- [prompt.c (git source)](https://github.com/git/git/blob/master/prompt.c)
- [usage.c (git source)](https://github.com/git/git/blob/master/usage.c)
- [git-command-manager.ts (actions/checkout source)](https://github.com/actions/checkout/blob/main/src/git-command-manager.ts)
- [git documentation, environment variables (git source)](https://github.com/git/git/blob/master/Documentation/git.adoc)
- [Error: fatal: could not read Username for 'https://github.com': terminal prompts disabled (actions/checkout issue 664)](https://github.com/actions/checkout/issues/664)
- [git-auth-helper.ts (actions/checkout source)](https://github.com/actions/checkout/blob/main/src/git-auth-helper.ts)
- [actions/checkout](https://github.com/actions/checkout)
- [input-helper.ts (actions/checkout source)](https://github.com/actions/checkout/blob/main/src/input-helper.ts)
- [Repository not found - Checkout specific repo (actions/checkout issue 853)](https://github.com/actions/checkout/issues/853)
- [Submodules checkout "repository not found" error without PAT (actions/checkout issue 2080)](https://github.com/actions/checkout/issues/2080)
- [toolrunner.ts (actions/toolkit source)](https://github.com/actions/toolkit/blob/main/packages/exec/src/toolrunner.ts)

## Frequently asked questions

### How do I fix "could not read Username for 'https://github.com'" in GitHub Actions?

Give git a credential GitHub accepts. Check that the token passed to checkout has not expired or been revoked and is spelt right, give a tool that clones by itself a token, and keep persist-credentials on in a job that pushes. git exits with code 128.

### What causes it?

In order: the token passed to checkout is expired, revoked or mistyped; a later git command runs without the credential checkout kept; or a tool fetches a private repository over HTTPS by itself. A valid token that cannot read a repository gets "Repository not found" instead.

### How do I tell which one I have?

Look at which step printed it. A checkout step with a token input points to the token. A run step points to a git command or a tool with no credential. A checkout of another repository or of submodules that says Repository not found is a token that cannot read it.

### What should I check before changing anything else?

That git exited 128, its fatal error code: a run step reports it, and checkout logs git failing with exit code 128. Then whether the failure happens only on some pull requests, which points to the token those runs receive, and that the secret's name matches the one the workflow uses.
