Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4072 pages
Security and hardening

git push or clone to GitHub over HTTPS refuses a password that is correct

Errorremote: Support for password authentication was removed on August 13, 2021.

Short answer

GitHub no longer accepts your account password for Git over HTTPS, so a correct password is still refused. When Git asks for a password, give it a personal access token, or let Git Credential Manager sign you in. If a token is refused too, look for an old saved credential, an expired or under-permissioned token, or missing SSO authorization.

  • Applies to Git 2.4x, Git Credential Manager, GitHub.com, macOS and Windows credential stores
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Fix it fast

  1. 1Find out which cause you have

    Look at which URL form the repository uses, and which credential helpers Git has configured. A saved credential is used before Git asks you anything, so the helper list shows where an old value may hide.

    git remote -v
    git config --show-origin --get-all credential.helper
  2. 2Match what you see, then jump to its fix

    1. 1Git prompts for a username and password, you enter your usual login, and the removed-password message follows.Your GitHub account password was typed where a token belongsFix
    2. 2No prompt appears at all, yet the same error comes back every time.An old password or token is saved in the keychain or Credential ManagerFix
    3. 3The token worked earlier, or Git accepts it for reading but rejects the push.The token expired, was removed, or lacks permission for this repositoryFix
    4. 4Your own repositories work, but the organization's repositories are refused with the same token.The repository belongs to an organization that enforces SAML single sign-onFix

What does the error look like?

  • remote: Support for password authentication was removed on August 13, 2021.
  • remote: Please use a personal access token instead.

Cause 1 of 4

Your GitHub account password was typed where a token belongs

1Check

GitHub's guidance is that when Git asks for your password you enter a personal access token instead. If the https:// remote prompts and you typed the login password, this is the reason.

git remote -v

2Fix

Create a personal access token and paste it at the Password prompt (the username stays your GitHub username). To avoid handling tokens by hand, use Git Credential Manager, or sign in with the GitHub CLI and answer yes to authenticating Git.

# macOS: Git Credential Manager configures Git for you
brew install --cask git-credential-manager

# any system: sign in once with the GitHub CLI, choose HTTPS
gh auth login

3Verify

A command that talks to the remote now succeeds, or asks for the token once and then stops asking.

git ls-remote origin

Confirmed by docs.github.com

Did this fix it?

Cause 2 of 4

An old password or token is saved in the keychain or Credential Manager

1Check

Git hands the saved value to GitHub before it prompts. GitHub warns that outdated credentials cached in Windows Credential Manager make Git fail to access GitHub, and macOS keeps the same kind of entry in Keychain Access under github.com.

git config --show-origin --get-all credential.helper

2Fix

Make the store forget the entry for github.com, then let Git ask again. On Windows, open Credential Manager in the Control Panel under User Accounts, find the GitHub entry and delete it. On any system, git credential reject passes the host to each configured helper, which may erase a matching credential.

# any system with a credential helper
printf "protocol=https\nhost=github.com\n\n" | git credential reject

# macOS Keychain only
git credential-osxkeychain erase
# then type these two lines and press Return:
#   host=github.com
#   protocol=https

3Verify

The next network command prompts for credentials again; enter the username and a valid token.

git ls-remote origin

Confirmed by docs.github.com

Did this fix it?

Cause 3 of 4

The token expired, was removed, or lacks permission for this repository

1Check

In GitHub open Settings, Developer settings, Personal access tokens. A token can carry an expiry date, and GitHub removes tokens that have not been used for a year. A fine-grained token needs the Contents permission at write level to push; a classic token needs the repo scope to use repositories from the command line.

git push --dry-run origin HEAD

2Fix

Generate a new token with the access the repository needs and an expiry you can live with, then replace the saved credential using the previous cause so the old one is not sent again.

# after creating the new token, clear the old one and retry
printf "protocol=https\nhost=github.com\n\n" | git credential reject
git push origin HEAD

3Verify

The dry run and the real push both complete without a password error.

git push --dry-run origin HEAD

Confirmed by docs.github.com

Did this fix it?

Cause 4 of 4

The repository belongs to an organization that enforces SAML single sign-on

1Check

GitHub says a token must be authorized before it can reach an organization that uses SAML single sign-on. Authorization is done per token and per organization, in the Configure SSO control next to the token under Developer settings.

git ls-remote https://github.com/ORGANIZATION/REPO.git

2Fix

Open Settings, Developer settings, Personal access tokens, choose Configure SSO next to the token, and press Authorize beside the organization. If you do not see Configure SSO, sign in once through your identity provider first.

# no command line step: the authorization is a button in GitHub settings
# afterwards, repeat the failing command
git ls-remote https://github.com/ORGANIZATION/REPO.git

3Verify

The organization's repository now lists its refs.

git ls-remote origin

Confirmed by docs.github.com

Did this fix it?

How do I stop it coming back?

  • Use Git Credential Manager or the GitHub CLI so nobody pastes tokens by hand, and keep the helper in the global Git config.
  • Give every token an expiry date and a reminder to renew it before it runs out.
  • Grant the smallest permission that works: fine-grained tokens with Contents access on one repository beat a classic token with the repo scope.
  • Switch a personal machine to an SSH key if you prefer never to handle tokens.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Related fixes

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.