GitHub login continuosly required (2-factor authentication enabled)
Asked by Alessandro Piccione:

Hi,

SourceTree continuosly requires to login. The gitHub login window appear when I ask "Pull" on SourceTree. I enter the credentials and then the code sent to my phone. It works.  
A new personal access token has been added to my account every time.  
10 minutes later it require to login again.  

2-factor authentication was always enabled  
SourceTree is set to use the system Git.  
I tried to disable the "" in the Options/Git  
I don't have any SSH key.  
I authorized GOAuth fot SourceTreeForWindows today but the issue persists.

SourceTree v 2.6.10  
Git v 2.17.1

Repositories are in private/corporation repositories registered on GitHub.  
I use many repositories, mainly the the "Use default settings" is enabled.

This issues exists from a long time for my colleagues (at least 6 months) and started only the last month for me.

Regards,

Alex


Answers:
author: minnsey
body: Hi  

It sounds like the Git process completes successfully when you do enter the credentials? If so that portion of the *Git Credential Manager for Windows* (GCMW) is working.  

The GCMW will store credentials under the key 'git:<https://github.com>' in the Windows Credential Manager, if you look you will see that there is no user information stored there, it is just credentials to use against GitHub, are you using more than one GitHub account? If so the GCMW will often find the wrong credentials, for the *other* account, when it tries them they will fail and the GCMW will delete the *bad* ones and prompt you for *good* ones. Obviously the next time you try to pull from the *other* account the process repeats.

Is it possible you are hitting this?

comments: author: Alessandro Piccione
body: Yes the git logins are successful.  
Me and my colleagues have the same problem, sometime just ignoring that login window doesn't impede the pull/push.  

I "touched" many git repositories registered in SourceTree and**the problem seems to be solved** .  
It was probably related to the *\[user\]* data in the git configuration of one of that.  
I reduced the number of open tabs and I set the "Use global user settings" for all (in Repository Settings/Advanced/User information).

Yes, I have 2 GitHub accounts. I have this problem only at the work pc, at home I use only my private GitHub account (without 2-factor auth).  

Both the causes could have generated the issue but I haven't used my personal repos for a while and the problem starts suddenly. This make me think the problem was a wrong repos settings or the fact them were mixed (use global user settings and not).

A colleague still have the same problem, I suggested her to change all the repos to use the global user settings and reduce the open tab/repos to only a few. I think she does not have a private GitHub account.  

I'll update this post the next week.


author: Alessandro Piccione
body: It is ok now for me.  
I used CCleaner and I had to set the login for every repository again, but once done it is ok.

<br />

My colleague still have the problem.   
On SourceTree she set "use global user settings" but opening the options again shows the checkbox un-checked again. Also running SourceTree as Administrator.

Anyway thanks for the explanation.


Tags: github