Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Connect SourceTree to 2-factor enabled GitHub

Plase provide a detailed summary of how to connect SourceTree to 2-factor enabled GitHub.

2 answers

1 accepted

I finally made it work.  I will try to summarize as best I can for others needing SourceTree to connect to GIT using 2-factor authentication (2FA):

  1. SourceTree: Tools > Options > Authentication:  Delete as many password accounts as you are able to delete.  Try deleting at least twice for those accounts that are hard to delete.

  2. Close SourceTree.

  3. Windows: Enter Control Panel > User Accounts > Manage Windows Credentials.  Delete all "Git-look-alike" credentials, i.e. the credentials in SourceTree: Tools > Options > Authentication that you were not able to delete.

  4. GitHub:  Set up 2FA.  I used SMS-verification.  Google a bit and you will find a guide.  This step was quite straight-forward.

  5. GitHub:  Create a token: Log in to GitHub, press user drop down arrow at upper right corner, choose 'Settings', choose 'Developer settings', choose 'Personal access tokens', choose 'Generate new token'.  I gave the new token access rights to everything.  Save the token.  My token was a string consisting of 40 characters.

  6. SourceTree: Clear all saved password:  Windows: Go to C:\Users\USERNAME\AppData\Local\Atlassian\SourceTree and remove the 'passwd' file.  The purpose of this step, is to force SourceTree to ask for password in next step.

  7. SourceTree: Open SourceTree and do a Pull Request. SourceTree will now ask for password.  Use the token from (5) as password.
Charlie Misonne Community Leader Jul 09, 2021

I'm glad you sorted it out and thanks for documenting the steps for other community members!

You can mark your own answser as accepted if you want to.

Hi again,

I read your post while answering your other one.

I haven't used SourceTree myself since a while. But I found this article in the documentation: Two-Factor Authentication (2FA) with GitHub in SourceTree 

The article says: "For versions earlier than SourceTree 2.4 for Mac and SourceTree 1.10 for Windows." SO I'm not sure if it will be of any help.
But I hope it points you in the right direction.

UPDATE:

I found the information for recent versions.

Apparenltly newer versions support the Windows Credential Manager which supports 2FA.
So you'll need to use that tool.
See more on SourceTree for Windows 1.10.0-* authentication and accounts updates 

Thanks for answering.  Before installing a new password manager, i tried https://confluence.atlassian.com/sourcetreekb/two-factor-authentication-2fa-with-github-in-sourcetree-402033499.html

But, unfortunatively, SourceTree seems to be extremely buggy in its Tools > Options > Authentication window:

  • NOT WORKING: Deletion of any password account set as "default account".
  • NOT WORKING: Editing any password account set as "default account".  (If trying to edit, the current passord account is not changed, but a new password account is created).
  • UNSTABLE:  Deleting password account not set as default account.  (Seems to me as if the *second* attempt to delete account normally works).

ALSO NOT WORKING:

  • If a new password account is created, I am not able to set it as default. 

As far as I can see, this effectively means that it is impossible to edit a default password account(!)

 

I am using latest SourceTree version 3.4.5.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Sourcetree

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

4,272 views 4 8
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you