Fix GitHub Login Errors

The symptom

You typed git push (or clicked Sync in VS Code), entered your GitHub password when asked, and got this wall of red:

The exact error

Terminal
$ remote: Support for password authentication was removed on August 13, 2021.
$ remote: Please see https://docs.github.com/get-started/getting-started-with-git/about-remote-repositories for information on currently recommended modes of authentication.
$ fatal: Authentication failed for 'https://github.com/you/project.git/'
In VS Code
  1. The same text appears in an error toast (bottom-right) when a push or Sync Changes fails
  2. Click Open Git Log in the toast to read the full message in the Output panel

This is Git's message, not commands to run.

What it means

Your GitHub account password — the one you type on the website — no longer works for Git over HTTPS. GitHub switched that off in 2021. Nothing is broken on your machine; Git just needs a different kind of key: a personal access token (a long generated password made only for Git), an SSH key, or a browser sign-in via the gh command-line tool. The full setup of all three lives in Connect to GitHub — this page is the fast repair.

Tip: a token is a password — just one made for Git. Paste it wherever Git asks for a "password", never commit it to a repo, and if it ever leaks, delete it on GitHub and make a new one.

The quick fix

The fastest cure is GitHub's own command-line tool, gh. One command opens your browser, you click Authorize, and it wires up Git for you — no token to copy, nothing to memorise.

Sign in properly, once

Terminal
$ gh auth login   # browser sign-in wires everything up
In VS Code
  1. Click the Accounts icon (the person, bottom-left)
  2. Sign out of GitHub, then sign back in when prompted
  3. Push again — VS Code handles the token behind the scenes

Don't have gh? It's a free install from cli.github.com — or use the VS Code route, which needs nothing extra.

The stale-credential trap (Windows)

Here's the sneaky one. The first time you signed in, Windows saved that login and quietly re-sends it on every push. If the saved token has expired — or was your old password — every push fails, even after you fix your account, because Git never asks you again. It just keeps replaying the stale login. The cure is to throw the saved one away:

Flush the saved login

Terminal
$ git credential-manager github logout
$ # then push — you'll get a fresh sign-in prompt
In VS Code
  1. No VS Code button for this — use Windows itself: Control Panel → User Accounts → Credential Manager → Windows Credentials
  2. Find the git:https://github.com entry and click Remove
  3. Push again and sign in fresh

On macOS the same login hides in Keychain Access — search for 'github' and delete the entry.

Wrong account?

A close cousin: remote: Permission to someone/project.git denied to other-user (a 403 — web-speak for "you're signed in, but not allowed"). Git is authenticating fine — just as the wrong person, usually a work account or an old username saved on the machine. It's the same stale-credential trap in a different costume, and the same fix: clear the saved login as above, push again, and sign in as the right user.

Up next: the other classic push blocker — GitHub refusing a file over 100 MB. Fix it in File Too Large to Push.

FAQ

Frequently Asked Questions

Why does GitHub say password authentication was removed?
GitHub retired account passwords for Git over HTTPS in August 2021. You now authenticate with a personal access token, an SSH key, or a browser sign-in via gh auth login — full setup in Connect to GitHub.
Where is my GitHub login stored on Windows?
In Windows Credential Manager (Control Panel → User Accounts → Credential Manager → Windows Credentials), under an entry named git:https://github.com. Git Credential Manager saves it after your first sign-in and silently re-sends it on every push.
Git keeps using the wrong GitHub account — how do I switch?
Clear the saved login with git credential-manager github logout (or delete the git:https://github.com entry in Credential Manager), then push again — Git will prompt a fresh sign-in, and you pick the right account.
Do I need to create a new token every time one expires?
Only if you manage tokens by hand. Easier options: gh auth login refreshes credentials for you automatically, and an SSH key never expires. If you do use tokens, you can set a longer expiry when creating one on GitHub.