GitHub login keeps popping up in SourceTree
Asked by Peter:

I recently tried pulling my GitHub repo with SourceTree and it kept failing. I was prompted to log into GitHub, so I filled in my username and password, but it still failed. I tried creating an SSH key and using that, still nothing. I googled whether my 2FA could've had something to do with it - got some guide on creating Personal Access Tokens, followed that, still nothing. I updated SourceTree to the newest version, repeated the steps, nothing. Checked the Options-\>Authentication, sure enough my GitHub account is there, but still nothing. Used the local Git, the embedded Git, still nothing. So at this point I'm running out of ideas to try out as multiple GitHub Login windows are popping up on my computer...

So, how do I connect SourceTree to GitHub, where I have 2FA enabled?


Answers:
author: Bob Nies
body: I'm sorry Atlassian, but you really screwed up your program. Going back to version 1.9.13. Yes I know you will tell me there are security issues, but at least it works.

comments: author: bozmonster
body: I agree, it's like source tree is being handed over to completely different dev teams every few months. Even the logo changes constantly.

Almost tempted to just make a Git client myself, because Source tree is so unstable that the only thing that works reliably is the log of the commit history - but very often I am forced to use the command line which makes me question why I'm using ST in the first place


author: James McParlane
body: I had the same problem. I found the thread you linked to useful, but I had to perform both options to get it to work.

This worked for me (Windows 10)

1) I installed Git from <https://git-scm.com/download/win>

2) In SourceTree in the Tools/Options/Git Config section, I clicked on "Use System Git"

3) I downloaded [https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/download/v1.14.0/gcmw-v1.14.0.zip](https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/download/v1.14.0/gcmw-v1.14.0.zip?)

4) I unzipped it and copied to the files to "C:\\Users\\%USERNAME%\\AppData\\Local\\SourceTree-Settings\\beta\\git_local\\mingw32\\libexec\\git-core"

5) I restarted SourceTree.

a) I found the reference to 'beta' confusing (I had also tried the latest SourceTree Beta to resolve this issue - to no avail) but went along with it.

b) I found it confusing that by setting git to be SYSTEM and not EMBEDDED that updating what appears to be the EMBEDDED git files worked. I tested going back to EMBEDDED and had the same issue as before. I will just go along with this counterintuitiveness.

After these steps - Instead of popping up multiple Github Logins, I just got the one (yay!) and was then asked for 2FA, and everything worked. (even more yay!)

Every time I install Source Tree, the security configuration appears to get more and more painful. This is a terrible user experience still.

comments: author: James McParlane
body: NOTE: Use OAuth or you will be put through the 2FA process every authenticated operation you perform on a repository and rapidly create a lot of GitHub tokens :(


author: djwollam
body: This solution worked for me. Thank you sir!


author: Csardas
body: Thanks a lot, James! It works!

BTW your link provided at step 3) has expired. So I went to [the latest GitHub page](https://github.com/microsoft/Git-Credential-Manager-for-Windows) and download the zip; Here I just followed the manual installation [instruction](https://github.com/microsoft/Git-Credential-Manager-for-Windows#manual-installation) and run the install.cmd directly.

Then I just followed the rest steps and YAYYYYYYYYYYYYYYYY!


author: josh_yoder
body: I got this fixed by just updating the Git credential manager on windows. Seems to work great now.  

Atlassian, if there's a dependency that needs to be updated, instead of just being silent, maybe notifying your user base would be more helpful. I got the notification to update Git and Git LFS, but not the credential manager.


author: Ana Retamal
body: Hi! You'll need to update your version of Git so that the credential manager supports Github's recent security changes. You can read more about it on [this Community thread](https://community.atlassian.com/t5/Sourcetree-questions/How-do-I-setup-Sourcetree-to-access-Github-now-that-they/qaq-p/735377).

If after that it's still failing for you, let us know:

1. Are you on Windows or Mac?
2. Which Sourcetree and OS version are you using?
3. Have you tried the command line?

Let us know how it goes!

Ana

comments: author: Mujtaba Alam
body: [@Ana Retamal](/t5/user/viewprofilepage/user-id/1067288)

I am having the same issue but it's for Mac and its connected to bitbucket and github.


author: Ana Retamal
body: HI [@Mujtaba Alam](/t5/user/viewprofilepage/user-id/1180127), have you updated already your version of Git? In which version are you?


author: fernandorr
body: I have the last version of GIT (2.16.3) and Sourcetree.

I was using the embedded git and every time i tried to pull or push it was told that my password was wrong. So i had to reconnect my account (in both cases, push and pull. yes, 2 logins).

I read somewhere that if i used the system git it would solve the problem, and it solved, til yesterday.

Now i have to login every time i try to do anything and it's happening with or without the git system.

I really need a fix for this :(


author: T K
body: I had the exact same problem. Both SourceTree and Git (Git credential manager) upgraded to the latest version.

So i **deleted all of my account credentials** and opened up source tree in **Administrator mode.** I reentered my credentials once (using OAuth) and the problem was gone.

I'm guessing the credential manager could not update credentials if it was not ran as Administrator (?)


Tags: 2-factor-authentication

github

login