How to Fix “Support for password authentication was removed.”?

With the increasing focus on security in software development and deployment, many platforms are moving away from less secure methods of authentication. GitHub, in particular, has deprecated password-based authentication for Git operations, encouraging users to adopt more secure methods such as personal access tokens (PATs) and SSH keys. If you’ve encountered the error “Support for password authentication was removed,” this article will help you transition to using personal access tokens or SSH keys for authentication.

Password authentication error occurs when attempting to perform Git operations (like git clone, git push, or git pull) using a username and password. GitHub has removed this method to enhance security and protect user accounts from unauthorized access.

There are various methods to fix password authentication problems which are as follows:

Table of Content

  • Using Personal Access Tokens (PATs)
  • Using SSH Keys

Using Personal Access Tokens (PATs)

A personal access token is a secure way to authenticate with GitHub from the command line or other applications.

Steps to generate a Personal Access Token:

  • Go to GitHub and log into your account.
  • Click on your profile picture in the top-right corner and select “Settings”.
  • In the left sidebar, click on “Developer settings”.
  • Click on “Personal access tokens”, then click on “Tokens (classic)”.
  • Click on “Generate new token”.
  • Provide a note to describe the token and select the scopes or permissions you want to grant this token. For typical Git operations, you might select repo (all) and workflow.
  • Click “Generate token”. Make sure to copy the token and store it securely; you won’t be able to see it again.

Using the Token in Git Operations

When prompted for a password during a Git operation, use the personal access token instead of your GitHub password.

git clone https://github.com/username/repository.git

When prompted for your username and password, enter your GitHub username and the personal access token as the password.

Storing the Token in Git Config

To avoid being prompted for the token each time, you can store it using Git’s credential helper.

git config --global credential.helper store

The next time you enter your token, it will be stored in plain text in a local file on your computer. Be cautious about this method due to security risks.

Using SSH Keys

SSH keys provide a secure way to authenticate without needing to enter a password or token every time.

Step-by-Step Guide to Using SSH Keys:

Step 1: Generate an SSH Key

If you don’t already have an SSH key, you can generate one using the following command

ssh-keygen -t ed25519 -C "your_email@example.com"

Follow the prompts to save the key (default location is usually fine). You can set a passphrase for added security.

Step 2: Add the SSH Key to the SSH Agent

Start the SSH agent in the background and add your SSH key

eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519

Step 3: Add the SSH Key to Your GitHub Account

  • Copy the SSH key to your clipboard:
  • Go to GitHub and log into your account.
  • Click on your profile picture in the top-right corner and select “Settings”.
  • In the left sidebar, click on “SSH and GPG keys”.
  • Click “New SSH key”, give it a title, and paste your key into the “Key” field.
  • Click “Add SSH key”.

Step 4: Using SSH for Git Operations

Use the SSH URL for Git operations instead of the HTTPS URL.

git clone git@github.com:username/repository.git

Contact Us