Sling Academy
Home/DevOps/Fixing GitHub Error: Support for password authentication was removed

Fixing GitHub Error: Support for password authentication was removed

Last updated: January 27, 2024

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.

Next Article: Deleting local files from the current Git working tree

Previous Article: Git Error: ‘src refspec master does not match any’ – How to Fix (3 solutions)

Series: Git & GitHub Tutorials

DevOps

You May Also Like

  • How to reset Ubuntu to factory settings (4 approaches)
  • Making GET requests with cURL: A practical guide (with examples)
  • Git: What is .DS_Store and should you ignore it?
  • NGINX underscores_in_headers: Explained with examples
  • How to use Jenkins CI with private GitHub repositories
  • Terraform: Understanding State and State Files (with Examples)
  • SHA1, SHA256, and SHA512 in Terraform: A Practical Guide
  • CSRF Protection in Jenkins: An In-depth Guide (with examples)
  • Terraform: How to Merge 2 Maps
  • Terraform: How to extract filename/extension from a path
  • JSON encoding/decoding in Terraform: Explained with examples
  • Sorting Lists in Terraform: A Practical Guide
  • Terraform: How to trigger a Lambda function on resource creation
  • How to use Terraform templates
  • Understanding terraform_remote_state data source: Explained with examples
  • Jenkins Authorization: A Practical Guide (with examples)
  • Solving Jenkins Pipeline NotSerializableException: groovy.json.internal.LazyMap
  • Understanding Artifacts in Jenkins: A Practical Guide (with examples)
  • Using Jenkins with AWS EC2 and S3: A Practical Guide