FIX · ERROR

"Authentication failed".
Your password is not the key.

Since August 13, 2021, GitHub does not accept your account password for Git over HTTPS. If git push or git clone asks for a password and then fails, this is almost always why.

personal access tokengh auth logincredential managerSSH remote

The short answer

pick one
1

Easiest: GitHub CLI

Run gh auth login and follow the prompts. GitHub recommends it, and Git then uses that login over HTTPS.

2

Use a token

Create a personal access token on GitHub. When Git asks for a password, paste the token instead of your password.

3

Use SSH

Switch the remote to SSH with git remote set-url origin git@github.com:OWNER/REPOSITORY.git and add an SSH key to your account.

Git Credential Manager (included with Git for Windows) is the other recommended route. It handles sign-in, including two-factor authentication, and remembers it for you.

What you saw

as reported publicly

Older reports show remote: Invalid username or password. followed by the same fatal: Authentication failed line. Both mean GitHub did not accept what you typed. The exact wording can differ by Git version, so match on Authentication failed. I could not reproduce these lines on my machine, because they need a real GitHub login. They are quoted from public reports and GitHub's own docs, linked below.

Using a token as the password

from GitHub Docs

GitHub's docs say it plainly: the next time you git fetch, git pull or git push, you are asked for your username and password. When Git asks for the password, enter your personal access token. Create one in your GitHub settings under Developer settings. Give it only the access you need, and set an expiry. Treat it like a password: never paste it into a repository or a chat.

Without a credential helper you would have to paste the token on every push. Use gh auth login or Git Credential Manager so it is stored securely and you stop retyping it.

Stuck on old saved credentials

common on Windows

If you saved the old password earlier, Git keeps sending it and keeps failing, without asking again. GitHub's docs say to open Credential Manager in the Windows Control Panel, find the GitHub entry and delete it. Git then prompts you fresh.

Check which kind of URL you use

one command

git remote -v shows your remote URL. A URL starting with https:// uses the token or login route above. A URL starting with git@github.com: uses SSH keys, and its failures look different because they are about keys, not passwords. To change a remote between the two, use git remote set-url origin NEW-URL.

Sources

read these, not me

GitHub changelog: Git password authentication is shutting down
GitHub Docs: Caching your GitHub credentials in Git
GitHub Docs: Managing remote repositories

Questions people ask

Why does git push say Authentication failed?

GitHub stopped accepting account passwords for Git over HTTPS on August 13, 2021. Use a personal access token as the password, GitHub CLI, Git Credential Manager, or an SSH remote.

What do I type when Git asks for my GitHub password?

Your personal access token, created in GitHub settings, not your account password.

How do I stop Git asking for credentials every time?

Run gh auth login or use Git Credential Manager so the login is stored securely.

Git keeps failing and never asks for a new password. Why?

Old credentials are cached. On Windows, delete the GitHub entry in Credential Manager so Git prompts again.

Git, Visually · Parts 1 and 2 · English