Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Support for password authentication was removed. Please use a personal access token instead

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?

like image 355
Daemes Avatar asked Aug 13 '21 16:08

Daemes


People also ask

How do I fix support for password authentication was removed from GitHub?

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.

How do I authenticate with personal access token?

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.


Video Answer


3 Answers

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 Done

If you don’t find git:https://github.com => Click on Add a generic credential => Internet address will be git: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 for github.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.

like image 83
sta Avatar answered Oct 20 '22 05:10

sta


If you're using macOS, just simply follow these steps:

  1. Go to this link: https://github.com/settings/tokens (Profile -> settings -> developers setting -> personal access tokens). (don't go to repository setting; it's your profile setting)
  2. Generate a new token and copy-paste it somewhere safely.
  3. Now search for an app in your Mac, named Keychain Access.
  4. Search for github.com (if there are multiple GitHub logins then choose Kind: Internet password), double-click it.
  5. Click on show password, then enter your Mac's password and hit Enter.
  6. Password should be visible by now. Now, just paste the token you generated in step 2 and click Save changes.

And that's it. Enjoy!

If you're using Windows:

  1. Follow steps 1 and 2 as above.
  2. Search for an application in your Windows OS, named Credential Manager → then Windows Credentials.
  3. Search for github.com and edit the password with the token you have generated on GitHub. Now enjoy!

Developer's hack (shortcode):

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.

like image 456
kartik tyagi Avatar answered Oct 20 '22 05:10

kartik tyagi


Use My AccountSettingsDeveloper settingsPersonal access tokensGenerate new token.

git remote set-url origin https://<token>@github.com/<username>/<repo>
like image 298
ßãlãjî Avatar answered Oct 20 '22 05:10

ßãlãjî