DEV Community

Unpublished Post. This URL is public but secret, so share at your own discretion.

How to Fix "Support for password authentication was removed" error in GitHub

I was trying to push my latest committed code to the remote GitHub repository, but faced the following error message:

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/collabnix/reponew'
Enter fullscreen mode Exit fullscreen mode

To fix the "Support for password authentication was removed" error in GitHub, you need to switch to using a personal access token (PAT) instead of a password for authentication. Here are the steps to follow:

Step 1. Create a personal access token (PAT) on GitHub

Login to your GitHub account. Go to Settings.

Image1

Step 2. Generate a new token

Select "Developer settings," and then "Personal access tokens."

Image2

Next, you need to generate a new token by selecting the "Generate new token" button. Give your token a name and select the scopes you need. For cloning repositories, you need to select the "repo" scope.

Image3

Copy the token to your clipboard.

When prompted for your GitHub credentials while cloning a repository using an HTTPS URL, paste your PAT as your password.

Alternatively, you can configure Git to use your PAT for all future interactions with GitHub by running the following command in your terminal:

git config --global credential.helper store
Enter fullscreen mode Exit fullscreen mode

This command will save your credentials to a local file, so you don't have to enter them every time you interact with GitHub. You can then enter your GitHub username as usual, and your PAT as your password.

Keep in mind that using an SSH URL to clone a repository is a more secure and recommended option, as it allows you to authenticate using your SSH key instead of a password or PAT.

Top comments (0)