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

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 `Spoon-Knife`...
$ Username for 'https://github.com' : username
$ Password for 'https://github.com' : give your personal access token here

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.


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.


Use My AccountSettingsDeveloper settingsPersonal access tokensGenerate new token.

git remote set-url origin https://<token>@github.com/<username>/<repo>