However, when pushing changes to a GitHub-hosted repository or cloning an authenticated repo, you might encounter an error such as “support for password authentication was removed”.
In this tutorial, we will explore the cause/source of this error and how we can fix it when working with a Git repo.
Cause
As of August 2021, GitHub introduced the feature for any users to use the token-based authentication in order to perform various authenticated Git repositories.
This removed the feature of using the account passwords when authenticating to GitHub using REST API.
As a result, attempting to access or perform any authenticated operation on a GitHub-hosted repository using password authentication will result in the said error.
Solution
Let us proceed and discuss how you can quickly fix this error when attempting to push a code on the remote repository.
The method to fix this error is to enable and configure the access token on GitHub which allows us to perform the token-based authentication when running the Git operations.
To enable the access on token-based authentication, start by logging into your GitHub account and head over to the “Settings”.
In the “Settings” page, scroll down and look for the “Developer Settings” option.
In the “Developer Settings” window, select “Personal Access Tokens” and choose “Tokens (Classic)”.
At the top-right, choose “Generate new token” and select “Generate new token (classic)”.
In the next step, fill the details for the “Note” section and then set an expiration date for the access token. It is recommended to set an expiration date although GitHub allows you to create a non-expiring token.
Under the “Scope” section, enable the following scopes for your token:
- workflow
- delete:packages
- admin:org
- admin:public_key
- delete_repo
- admin:enterprise
- project
- admin:gpg_key
- admin:ssh_signing_key
Click on “Generate Token” with the selected scope.
Next, copy the resulting token.
Paste it into the password field when running the Git command.
This should help you fix the “support for password authentication was removed” error when performing changes to a repo or cloning an authenticated repo.
Conclusion
In this tutorial, we learned about the cause and the solution for the Git “support for password authentication was removed. Please use a personal access token instead” error while working with a Git repo.