Use token to push some code to GitHub - "Support for password authentication was removed"

Viewed 34945

Error message when using git push:

Support for password authentication was removed on August 13, 2021. Please use a personal access token instead. remote: Please see https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/ for more information. fatal: unable to access 'https://github.com/codingTheWorld777/react-mini-projects.git/': The requested URL returned error: 403"***

I cannot use my token to access GitHub, so how can I push code to GitHub?

8 Answers

GitHub announced their intent to require the use of token-based authentication for all authenticated Git operations. They will no longer accept account passwords when authenticating Git operations on GitHub.com:

Generate token:

On Mac:

  • Go to keychain Access
  • Press the Login tab and all items
  • Click GitHub key
  • Change the password to the recent generated token

Enter image description here

On Windows:

  • Go to Control PanelUser AccountsCredential Manager

  • Edit the Generic Credential of GitHub

  • Paste the token instead of the password

Enter image description here

You need to change the remote URL with:

git remote set-url <stream> https://<token>@github.com/<username>/<repo>

token can be found here.

I also encounter this problem today, on macOS.

I solve this problem by:

First, get a token! Follow the guidance of GitHub. I think you can just click the link provided in the warning.

Second, change the key chain on macOS:

  1. Search "Keychain" on macOS.
  2. Search "GitHub".
  3. Change the password in the one that with "Internet Password", using your new token.

Then, my problem is solved and I can "git push" now.

Step 1: Go to your GitHub account → SettingsDeveloper settingsPersonal access tokens → Generate / regenerate your token

Step 2: Go to https://cli.github.com and download GitHub CLI

Step 3: Go to your command line or Terminal → gh auth login and follow with login credentials. Done.

I have the same problem. For me the solution was install the GitHub CLI in https://cli.github.com/. After installing in my OS, I ran gh auth login in my terminal and logged in through the browser with the access token that I generated in the GitHub profile. Follow:

My AccountSettingsDeveloper settingsPersonal access tokens [GENERATE NEW TOKEN]

First of all, you need to create a personal access token in Creating a personal access token

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

Username: your_username

Password: your_token

Solution for Mac:

First generate a token from GitHub. And replace your password with the token from the keychain access in the GitHub section.

You need to create a personal access token. You can find the instructions on creating personal access token in Creating a personal access token

Make sure you keep the access token secure & secret. After that you need to replace your current saved password in the device (laptop/desktop) with the access token. In macOS you can search for Keychain and find GitHub with an Internet password and replace it with your access token. For instructions, see Updating credentials from the macOS Keychain.

In Windows, it might be Credential Manager (I'm not sure). Check this out: How to update your Git credentials on Windows

Related