Fixing GitHub Error: Support for password authentication was removed

Updated: January 27, 2024 By: Guest Contributor Post a comment

The Problem

GitHub is widely-used for version control and source code management. Unfortunately, users can sometimes encounter the error ‘Support for password authentication was removed.’ This error impacts users who attempt to perform Git operations over HTTPS and signals that GitHub has officially discontinued password authentication for Git operations, prompting the use of token-based authentication instead.

Cause of the Error

This error arises because GitHub has enhanced its security protocols. As of August 13, 2021, GitHub no longer accepts account passwords when authenticating Git operations via HTTPS, preventing the potential risks associated with password-based authentication such as phishing attacks or password leaks. Personal Access Tokens (PATs) or SSH keys must now be used to authenticate Git operations securely.

Solution 1: Use Personal Access Token (PAT)

A Personal Access Token (PAT) is a secure alternative to using passwords with GitHub. It can be configured with varying levels of access to replace the use of passwords.

  1. Create a new PAT via the GitHub website.
  2. Use the PAT when Git prompts for a password authentication.

Notes: After creating a PAT, treat it as a sensitive secret. You should also limit the scope of each token to the lowest level of access necessary and review your tokens periodically to rotate or revoke them as needed.

Solution 2: Switch to SSH Authentication

Using SSH keys is a secure method to authenticate with GitHub without needing a username or password for each Git operation.

  1. Generate a new SSH key pair on your machine.
  2. Add the public key to your GitHub account.
  3. Use SSH instead of HTTPS for cloning and working with repositories.

Notes: SSH is a secure and common method for authenticating with GitHub and has the benefit of not having to enter credentials for each operation. However, SSH keys must be managed properly to keep them secure.

Solution 3: Update Credential Manager

On some systems, credentials are stored using a manager. You should ensure that it is updated to handle the new authentication mechanism properly.

  1. Update or reconfigure your credential manager to handle PAT.
  2. Replace stored GitHub passwords with updated PATs in the credential manager.

Notes: Credential managers can be helpful by not requiring you to enter a PAT for every operation. However, incorrectly configured credential managers can cause authentication difficulties.

Conclusion

In conclusion, while the error ‘Support for password authentication was removed’ can be a surprise to some, it’s an important step towards enhancing the security of your repositories on GitHub. By following the given solutions, you can quickly regain access and continue your version control tasks seamlessly. Remember to always safeguard your tokens and SSH keys as you would with any credential.