Fix "Support for password authentication was removed" on GitHub
remote: Support for password authentication was removed on August 13, 2021. fatal: Authentication failed for 'https://github.com/user/repo.git/'
- remote: Invalid username or token. Password authentication is not supported for Git operations.
- remote: Invalid username or password. fatal: Authentication failed for 'https://github.com/user/repo.git/'
- fatal: could not read Username for 'https://github.com': terminal prompts disabled
- remote: Permission to user/repo.git denied to other-user. fatal: unable to access 'https://github.com/user/repo.git/': The requested URL returned error: 403
GitHub no longer accepts your account password for git push or git pull over HTTPS. Sign in with gh auth login or Git Credential Manager, or create a personal access token to use instead of the password; you can also switch to SSH.
What this error means
Since 13 August 2021, GitHub rejects username and password authentication for every Git operation over HTTPS. When Git asks for "Password", you must provide a personal access token or let a credential manager run an OAuth sign-in in the browser. The message appears if you type your password, or if an old password is still stored in the macOS Keychain, the Windows Credential Manager or a ~/.git-credentials file. A 403 "Permission denied to other-user" error rather means a credential for another account is stored.
Common causes
- Account password typed at the "Password for https://github.com" prompt instead of a token.
- Old credential stored in the Keychain, the Windows Credential Manager or
~/.git-credentials, which Git sends automatically. - Token expired, revoked or missing the right permissions (no access to the repository, no write permission on Contents).
- Organisation with SSO: the token has not been authorised for the organisation.
Step-by-step fix
-
Check the repository URL
If the URL starts with
https://, authentication goes through a token or a credential manager. If you see a password or token inside the URL, remove it (see the "Clean up" step).git remote -v -
Easy fix: GitHub CLI
gh auth loginopens a sign-in in the browser. Choose HTTPS and agree to authenticate Git with your GitHub credentials:ghbecomes Git’s credential helper. Works on Windows, macOS and Linux.gh auth login gh auth setup-git git push -
Alternative: Git Credential Manager
It ships with Git for Windows. On macOS, install it with Homebrew; on Linux, it is available as a
.debpackage or a tarball. On the next push, a GitHub sign-in window opens and the token is stored securely.# macOS brew install --cask git-credential-manager git credential-manager configure git push -
Or create a personal access token
GitHub > Settings > Developer settings > Personal access tokens > Fine-grained tokens > Generate new token. Limit it to the repositories you need, grant Contents Read and write, and set an expiry date. On the next
git push, type your GitHub username, then paste the token as the password. Treat it like a password: never commit it or paste it into a chat. -
Clean up old credentials
Delete the stored credential so Git asks you to sign in again. The
git credential rejectcommand works with the configured helper (macOS, Linux, Windows). On Windows, you can also open Credential Manager > Windows Credentials and removegit:https://github.com. Also remove any token written in the repository URL.printf "protocol=https\nhost=github.com\n\n" | git credential reject git remote set-url origin https://github.com/user/repo.git -
Alternative: switch to SSH
With an SSH key added to your account, no typing is needed. Test the key with
ssh -T [email protected]before pushing.git remote set-url origin [email protected]:user/repo.git ssh -T [email protected] git push
Did this fix work for you?
Confirm it in one click: it will rise for the next developers stuck on the same error.
Keep it from coming back
- Use a credential manager (gh, Git Credential Manager, Keychain) rather than
credential.helper store, which saves the token in plain text in~/.git-credentials. - Never put a token in the repository URL: it ends up in plain text in
.git/config, the shell history and sometimes CI logs. - Pick fine-grained tokens with an expiry date, and note when to renew them.
Frequently asked questions
What goes in "Username" and "Password"?
Username: your GitHub username. Password: the personal access token, not your account password. The token does not show while you type, that is normal.
What about GitHub Actions or another CI?
In GitHub Actions, use the automatically provided GITHUB_TOKEN. Elsewhere, store a dedicated token in the CI secrets, with the minimum permissions.
Classic token or fine-grained token?
Prefer fine-grained: it is limited to specific repositories and permissions. A classic token with the repo scope gives access to all your repositories; keep it for tools that do not support fine-grained tokens yet.
Useful tools for this error
More Git & GitHub errors
- Fix "failed to push some refs" (! [rejected] fetch first) in Git
- Fix "fatal: refusing to merge unrelated histories" in Git
- Fix "Permission denied (publickey)" with Git and GitHub
- Get out of "detached HEAD" state in Git without losing commits
- Fix "Your local changes to the following files would be overwritten by merge" in Git
- Resolve "CONFLICT (content): Merge conflict" and "Automatic merge failed" in Git
- Fix "GH001: Large files detected" (file over 100 MB) on GitHub