23

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?

ouflak
  • 2,458
  • 10
  • 44
  • 49
Wide Angle Technology
  • 1,184
  • 1
  • 8
  • 28

8 Answers8

111

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.

ouflak
  • 2,458
  • 10
  • 44
  • 49
Sam Su
  • 6,532
  • 8
  • 39
  • 80
  • 1
    Thanks man, this works. You're real MVP. Spent entire morning/mid afternoon browsing all the bullcrap. – Veljko Stefanovic Nov 29 '21 at 13:01
  • Thanks man appreciate the answer too. Cheers. – Nick Dec 04 '21 at 14:37
  • This was critical because everything else was about using the token as the password, but it would still fail with this error. Only updating the remote this way did it actually work. Thank you. – Aggressor Dec 04 '21 at 20:02
  • 3
    this is very bad way, this will make your token(PAT) vulnerable because everyone can see it. – noobsee Aug 17 '22 at 07:24
17

Step 1: Generate token : https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token

Step 2: Open .git > config file and replace [remote "origin"] URL like this

https://<username>:<githubtoken>@github.com/<username>/<repositoryname>.git
Parth kharecha
  • 6,135
  • 4
  • 25
  • 41
3

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/*
3

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.

  • 1
    Thank you! I was struggling with this because Sourcetree stopped asking for my password so there was nowhere for me to paste the token. The file deletion you suggest here seems to have solved the issue. – GarrickW Dec 28 '22 at 03:44
1

Beginning August 13, 2021, Github no longer accepts account passwords when authenticating Git operations and will require the use of token-based authentication.

Guide Line Youtube Video: https://youtu.be/eZrOd5qM5WM Steps to create Personal Access Token: http://mtahirmunir.com/github-support-for-password-authentication-was-removed/

tahir
  • 21
  • 1
  • 3
  • My question was deleted. I've summarised it at http://rodmclaughlin.com/difficulties-with-github-s-new-security-system. – rodmclaughlin Sep 21 '21 at 11:13
0

Faced the same issue with Sourcetree on MacOS.

You can also use Auth Type Basic in Sourcetree and use the PAT as your password.

To make it work I also had to delete the GitHub internet password from the keychain (see here https://howieyoung.medium.com/suffering-from-the-latest-403-error-from-github-on-sourcetree-e04a844efd35)

0

You only need 3 steps:

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

That's all.

noobsee
  • 806
  • 15
  • 29
  • Can you specify if the above solution is Windows (or Linux) OS only? I'm using macOS and I can't see a similar path in my system. – Andrej Mar 31 '23 at 11:37
  • I use Windows OS, but IMO it should works for all platform. The `passwd` file is from SourceTree, it should exist on all OS. – noobsee May 28 '23 at 08:54
0

macOS users

Seams that the issue happens if users in the past tried adding their Github account with wrong authentication. Then, even if you remove that account in SourceTree and try re-adding the same account again, the old authentication settings are used.

Here's a procedure that worked for me. Might need some polishing, but I hope users will find their way around.

  1. In Finder make sure you can see hidden files (Cmd + Shift + . )
  2. In your user folder go to /Library/Application Support/SourceTree
  3. Search for a file ending with STAuth-github.com and delete it

If you removed that account in SourceTree you should be able to add it again. If you didn't remove the account, than when trying to eg. fetch from repo, then SourceTree will ask you for authentication with personal access token.

Andrej
  • 7,266
  • 4
  • 38
  • 57