When I try to pull or push in GitHub, I am getting an error message: "Please use a personal access token instead."

Viewed 30660

I am using the version control as GitHub through SourceTree, but it is getting failed from 13th August, the below is the error I am getting from GitHub.

remote: 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.

Anybody know what was the problem, or how can I use the personal access token?

7 Answers

Since the OP is using SourceTree, do the following:

  1. Generate your Personal access tokens in Github account setting.
  2. Double click a repository in SourceTree, click Setting icon in the top right of the popup window.
  3. Click Remotes in the menu tab. You will see the remote URL of this repository, which should be like this https://github.com/username/repo.git.
  4. Click Edit and change it to https://<your_token>@github.com/username/repo.git.

DONE.

Faced the same issue and resolved it in this way:

Open sourcetree, in the right, click Settings (Repository settings) ->Remotes -> Select Origin and Edit:

Set URL/Path in the following format: https://<your_personal_access_token_from_github>@<git_url>.git

The other way to solve this is from git config file. For this, in your .git folder open open config file and replace [remote "origin"] URL like this

[remote "origin"]
    url = https://<your_personal_access_token_from_github>@<git_url>.git
    fetch = +refs/heads/*:refs/remotes/origin/*

First of all you need to create a Personal access tokens by going from your Github account -> Settings -> <> Developer settings -> Personal access tokens -> Generate new token. You specify a name for the token, expiration date, as well as what possibilities it may have. After clicking "Generate token", make sure you keep the code that will appear because you will use it as a login code to log in to Sourcetree with a Github account instead of your original github password.

Now, you have to re-enter your details to login, using as password the token you created. To do this, go to C:\Users\{your_user_folder}\AppData\Local\Atlassian\SourceTree and delete the passwd file, so force Sourcetree asks you to re-enter credentials.
Open SourceTree normally, and when it asks you to enter credentials, as password enter the token as mentioned above.

You only need 3 steps:

  1. Delete the passwd file in: \AppData\Local\Atlassian\SourceTree\
  2. Restart your SourceTree
  3. Relogin

That's all.

Related