I got this error on my console when I tried to use git pull
:
remote: Support for password authentication was removed on August 13, 2021. Please use a personal access token instead.
remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information.
fatal: unable to access "..." : The requested URL returned error: 403
It's very weird, because I just followed the documentation and created a token two weeks ago on GitHub. The token expires on Tue, Oct 26, 2021. Why has this been removed today?
How to fix remote: Support for password authentication was removed? Since we cannot use account passwords when authenticating git operations, we can fix this issue by generating the PAT(Personal Access Token) in GitHub and using the PAT as authentication for Git operations.
From your home page, open user settings , and then select Personal access tokens. Select + New Token. Name your token, select the organization where you want to use the token, and then set your token to automatically expire after a set number of days.
From August 13, 2021, GitHub is no longer accepting account passwords when authenticating Git operations. You need to add a PAT (Personal Access Token) instead, and you can follow the below method to add a PAT on your system.
Create Personal Access Token on GitHub
From your GitHub account, go to Settings => Developer Settings => Personal Access Token => Generate New Token (Give your password) => Fillup the form => click Generate token => Copy the generated Token, it will be something like
ghp_sFhFsSHhTzMDreGRLjmks4Tzuzgthdvfsrta
Now follow below method based on your machine:
For Windows OS ⤴
Go to Credential Manager from Control Panel => Windows Credentials => find
git:https://github.com
=> Edit => On Password replace with with your GitHub Personal Access Token => You are DoneIf you don’t find
git:https://github.com
=> Click on Add a generic credential => Internet address will begit:https://github.com
and you need to type in your username and password will be your GitHub Personal Access Token => Click Ok and you are done
For macOS ⤴
Click on the Spotlight icon (magnifying glass) on the right side of the menu bar. Type Keychain access then press the Enter key to launch the app => In Keychain Access, search for
github.com
=> Find the internet password entry forgithub.com
=> Edit or delete the entry accordingly => You are done
For a Linux-based OS ⤴
For Linux, you need to configure the local GIT client with a username and email address,
$ git config --global user.name "your_github_username" $ git config --global user.email "your_github_email" $ git config -l
Once GIT is configured, we can begin using it to access GitHub. Example:
$ git clone https://github.com/YOUR-USERNAME/YOUR-REPOSITORY > Cloning into `YOUR-REPOSITORY`... Username: <type your username> Password: <type your password or personal access token (GitHub)
Now cache the given record in your computer to remembers the token:
$ git config --global credential.helper cache
If needed, anytime you can delete the cache record by:
$ git config --global --unset credential.helper $ git config --system --unset credential.helper
Now try to pull with
-v
to verify$ git pull -v
Linux/Debian (Clone as follows):
git clone https://<tokenhere>@github.com/<user>/<repo>.git
For PhpStorm
If you are using PhpStorm, go to menu Git => pull and select authentication via Personal Access Token. Enter your
PAT
it will allow you to pull/push the changes.
Keychain Access
.github.com
(if there are multiple GitHub logins then choose Kind: Internet password
), double-click it.And that's it. Enjoy!
github.com
and edit the password with the token
you have generated on GitHub.
Now enjoy!git remote set-url origin https://<githubtoken>@github.com/<username>/<repositoryname>.git
While cloning:
git clone https://<username>:<githubtoken>@github.com/<username>/<repositoryname>.git
It will work on every OS (Mac, Windows, or Linux).
Cons: You have to remember or should need to do to each repository in your local. So I'll prefer everyone to use above mentioned steps.
NOTE:
For those who don't have this entry: it could be made. one way to do it is- to clone a project. then it will ask for your username and password. instead of password give it the token and then the entry would be made.
Use My Account → Settings → Developer settings → Personal access tokens → Generate new token.
git remote set-url origin https://<token>@github.com/<username>/<repo>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With