About this article: This article is reviewed against the cited sources. This is source research, not lab validation. Check the stated versions and your own requirements before making changes.
When git clone, git fetch, git pull or git push over HTTPS to GitHub ends with remote: Support for password authentication was removed on August 13, 2021. and fatal: Authentication failed for 'https://github.com/...', something is still sending your account password. GitHub does not accept account passwords for Git operations. Enter a personal access token where Git asks for the password, or switch the remote to SSH. Then find the saved password, script or remote URL that supplied the old one.
What the error means
GitHub's changelog says that "starting on August 13, 2021, at 09:00 PST, we will no longer accept account passwords when authenticating Git operations on GitHub.com", and that token-based authentication, "for example, personal access, OAuth, SSH Key, or GitHub App installation token", is required instead. GitHub's page on remote repositories now says "Password-based authentication for Git has been removed in favor of more secure authentication methods."
GitHub's pages print the date and the rule. They do not print the full remote: line above, so treat the line as the text people search for, not as a quotation from GitHub. Our own reading of Git 2.47.1 (remote-curl.c): when the server refuses the request and sends a text/plain body, Git prints each line of it with a remote: prefix and then ends with Authentication failed for '%s'. The remote: line is the server's words, and the fatal: line is Git's.
Two facts from GitHub's token page catch people out. A token goes where the password goes: "When prompted for your password, enter your personal access token instead of a password." And "Personal access tokens can only be used for HTTPS Git operations", so an SSH remote needs an SSH key.
Likely causes
| Cause | What you see | How to confirm |
|---|---|---|
| The account password is typed at the prompt | Prompt for a password, then the failure | GitHub's two-factor page says the prompt "won't specify" that a token is wanted, so the password gets typed |
| An old saved password is cached | No prompt at all, immediate failure | The credential store holds an old GitHub entry |
| A script or remote URL carries a password | Failure in a job, never a prompt | git remote -v shows credentials inside the URL |
| The token is wrong for the job | Failure after a token was entered | Token expired or deleted, wrong repository, or no repository permission |
| The organisation uses SAML single sign-on | Token works on personal repositories only | GitHub's pages say a classic token must also be authorised for the organisation |
| The remote is SSH, with a token supplied | Failure on a git@github.com: URL |
git remote -v shows an SSH URL |
| An old Git for Windows credential manager | Credential helper cannot sign in | GitHub's page says the older product "cannot connect to GitHub via OAuth" |
Prove the cause before changing anything
All of these only read.
1. Show the remote. GitHub's cloning-errors page uses this command:
git remote -v
A URL beginning https://github.com/ is an HTTPS remote; one beginning git@github.com: is an SSH remote. If the output shows a user name and password inside the URL, you have found the stale credential. Our own advice: the command prints that secret on screen, so run it where nobody is watching, and treat that password as exposed.
2. Test access without changing anything. The git fetch page describes --dry-run as "Show what would be done, without making any changes."
git fetch --dry-run origin
A good result ends without Authentication failed. A bad result shows that text. If a password prompt appears, stop there and do not type the account password: it repeats the fault. Our own advice: use the token fix below instead, and enter the token only once the credential store is understood.
3. Check the credential store. On Windows, GitHub's page says to open the Credential Manager in the Control Panel under User Accounts and look for the GitHub entry. On macOS the page names the Keychain. Look; do not delete yet.
4. Check the token. In GitHub, Settings, Developer settings, Personal access tokens. The page says GitHub "automatically removes personal access tokens that haven't been used in a year", so a token from a quiet service account can be gone.
Fix
Create a token and use it
GitHub recommends that you use fine-grained tokens, which "you can restrict to specific repositories". For a read-only job, the token page's example asks for contents:read and metadata:read. Our own advice: grant only what the job needs. The page also says "Fine-grained personal access tokens, while more secure and controllable, cannot accomplish every task that a personal access token (classic) can." If a fine-grained token still fails, the page's section on fine-grained token limitations applies, and the classic token is the other type the page documents.
First save the current state. This is a screen on GitHub with no command, so write down in a file the names and expiry dates of the tokens already listed on the Personal access tokens page, so you can tell the new one apart.
Risk: the next steps create a new credential. GitHub's page says "Treat your access tokens like passwords"; anyone holding the token has the access it was granted until it expires or is deleted.
In GitHub, click your profile picture, Settings, Developer settings, Personal access tokens, Fine-grained tokens, Generate new token. Enter a token name, choose an expiration, choose the repository and the permissions, and generate it. When Git next asks for a password, enter the token. The user name you enter must be present, though the page says it "is not used to authenticate you".
Only if you need to back out, the new token is deleted on the same page.
Risk: the next step deletes the new token, which stops everything that uses it. The page says that if a token was used to create a deploy key, "the deploy key will also be deleted". Our own reading: a deleted token cannot be brought back; you would generate a new one.
On the same page, click Delete beside the new token.
Replace a cached credential
On Windows, GitHub's page says to open the Credential Manager and find the GitHub entry. First save the current state: write down the entry's name and user name.
Risk: the next step deletes the stored credential. Our own reading: a deleted entry cannot be restored. Anything using that stored password stops working until it is given a new one.
Delete the GitHub entry, then run the Git operation again and enter the token when prompted.
Only if you need to back out, enter the previous credential again at the next prompt, if you still have it.
Let GitHub CLI or Git Credential Manager remember it
GitHub's page recommends GitHub CLI or Git Credential Manager for HTTPS, and says that after gh auth login you enter Y when asked whether to authenticate to Git with your GitHub credentials, and that GitHub CLI will then store your Git credentials.
First save the current state. If the command reports that the file does not exist, no copy is made and there is nothing to restore below; list what the sign-in changed with git config list --global instead. Our own reading: where the global configuration is $XDG_CONFIG_HOME/git/config, which the --global entry on the git-config page names as the write target when ~/.gitconfig does not exist, save that file instead.
cp -p ~/.gitconfig ~/.gitconfig.2026-12-03
Risk: the next command signs in to GitHub and stores a credential. Our own reading: it can also change the global Git configuration so that Git uses GitHub CLI for credentials; restoring the saved file does not remove the stored credential.
gh auth login
Only if you need to back out, the saved configuration file goes back; the stored sign-in stays.
Risk: the next command overwrites ~/.gitconfig with the saved copy, so any other change made to that file since the save is lost. It restores the configuration only.
cp -p ~/.gitconfig.2026-12-03 ~/.gitconfig
Switch the remote to SSH
GitHub's page gives the form git@github.com:user/repo.git and says you can use git remote set-url. This needs an SSH key already added to your account; the caching page points to "Connecting to GitHub with SSH".
First save the current state, into a file outside the repository because the output can hold a password:
git remote -v > ../remote-before.txt
Risk: the next command changes where origin points. Every later push and pull in this clone goes to the SSH address.
git remote set-url origin git@github.com:example-org/example-repo.git
Only if you need to back out, the saved HTTPS address goes back. Each line of the saved file reads origin, the address, then (fetch) or (push); take the address from the (fetch) line.
Risk: the next command points origin at the old HTTPS address again, so later pushes and pulls in this clone go there and fail the same way until a token is supplied.
git remote set-url origin <saved-url>
Example (illustrative): build-agent1 is rebuilt from an old image. Its nightly job runs git pull in a clone of https://github.com/example-org/example-repo.git. The job fails with fatal: Authentication failed for 'https://github.com/example-org/example-repo.git/'. git remote -v shows a plain HTTPS URL, and the credential store holds an old GitHub entry. The administrator creates a fine-grained token limited to that repository with contents:read and metadata:read, and an expiry of 3 March 2027, which is 90 days after 3 December 2026 (28 + 31 + 28 + 3 = 90). The old entry is deleted, and the next git fetch --dry-run origin asks for a password once. The token is entered there.
Confirm the fix
git fetch --dry-run originends withoutAuthentication failed.- The job that failed runs to its end, unattended.
- For a token, note its expiry date in your calendar.
What to watch afterwards
- GitHub's page says a token can carry an expiration; schedule the replacement before it, because an expired token fails the same way.
- Keep tokens out of remote URLs, scripts and shared files. GitHub's page says to store a token in a script as a secret and run the script through GitHub Actions.
- For an organisation with SAML single sign-on, authorise the token for the organisation after you create it.
Read next
Related articles you may want next.
- Troubleshootinggit push "! [rejected] main -> main (non-fast-forward)" or "(fetch first)": bring the remote's commits in, then push againgit push says rejected (non-fast-forward) or fetch first? Compare the tips, merge or rebase the remote's commits, then push. Force only on purpose.Read article
- TroubleshootingGitHub "remote: error: GH001: Large files detected" and "this exceeds GitHub's file size limit of 100.00 MB": remove the file from the commits you are pushing, or move it to Git LFSGitHub GH001 Large files detected? Files over 100 MiB are blocked. Find the commit that added the file, then amend it or move it to Git LFS.Read article
- TroubleshootingSSH "Permission denied (publickey)": what the server log says and what to fixSSH says Permission denied (publickey)? Read the sshd log line, then check authorized_keys modes, StrictModes, AllowUsers and accepted key algorithms.Read article
Risks and limits
- These commands have not been run or lab-tested.
- Our own reading: a deleted stored credential or token cannot be restored; you create a new one.
- A token is as sensitive as a password. GitHub's page says it "has the same capabilities to access resources and perform actions on those resources that the owner of the token has", limited by its scopes or permissions.
- The
remote:line is the text people search for, not a GitHub quotation; wording on the server side can change. - These steps apply to GitHub.com. Check your host's own page if you use another service.
Sources
- Git password authentication is shutting down — GitHub Changelog, 12 August 2021, accessed 3 December 2026
- Token authentication requirements for Git operations — The GitHub Blog, 15 December 2020 (updated 7 February 2022), accessed 3 December 2026
- Managing your personal access tokens — GitHub Docs, no date shown, accessed 3 December 2026
- Accessing GitHub using two-factor authentication — GitHub Docs, no date shown, accessed 3 December 2026
- Caching your GitHub credentials in Git — GitHub Docs, no date shown, accessed 3 December 2026
- About remote repositories — GitHub Docs, no date shown, accessed 3 December 2026
- Troubleshooting cloning errors — GitHub Docs, no date shown, accessed 3 December 2026
- git-fetch — Git documentation, manual page for the latest release shown, no date shown, accessed 3 December 2026
- remote-curl.c — Git source repository, tag v2.47.1, no date shown, accessed 3 December 2026
This article was originally published on .