Why did github authentication suddenly stop working?
Asked by jean-gobert de Coster:

Hi,  
I've been comiting to my github repository on a sporadic schedule. Last time was about a month ago (Jan 31st)

Since then, nothing changed: my github password didn't change, I didn't even touch my git, nor sourcetree.

Today I have to commit a crucial bugfix, and when I try, I get the following error:

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags origin master:master  
fatal: HttpRequestException encountered.  
Une erreur s'est produite lors de l'envoi de la demande.

remote: Invalid username or password.  
fatal: Authentication failed for '<https://github.com/jeango/TwinCATBrowser/>'

Pushing to <https://github.com/jeango/TwinCATBrowser>  
Termin? avec des erreurs, voir ci-dessus

I tried the following:  

- Refresh OAuth token  
- Re-create a new personal access token (and switched to basic to use that token as password)  
- Update embeded git version  
- Tried to push with terminal  
- git credential-manager clear

None of this worked. I had to restrain myself not to drive a fist through my computer's screen  

Edit: I disabled two factor authentication in github, and I could then do a push. But I don't want to disable 2 factor in the long run.


Answers:
author: jean-gobert de Coster
body: Just so other ppl who have this problem can easily solve it. Solution is to

1) install the latest git client (got mine here: <https://git-scm.com/download/win> )

2) set sourcetree to use system git (Go to "Tools \> Options \> Git " and click "Use System Git version")

comments: author: miguelfor
body: This worked for me, Thanks.


author: Sam Leatherdale
body: I also had to install the latest version of the Git Credential Manager:

<https://github.com/Microsoft/Git-Credential-Manager-for-Windows>


author: Sunil Raman
body: [@Sam Leatherdale](/t5/user/viewprofilepage/user-id/1334037)Thanks, this fixed the issue with command-line git bash on Windows and Bitbucket repositories, since even the latest stable Git download apparently ships with an older Git Credential Manager.


author: nguyeag0
body: Can one of you tell me where to change the sourceTree.

I have downloaded the latest git client and the latest git credential manager.

I now have this error message:

```
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
fatal: the remote end hung up unexpectedly
Pushing to https://myLogin@bitbucket.org/myLogin/myPorject.git
error: failed to push some refs to 'https://myLogin@bitbucket.org/myLogin/myProject.git'
```

Where is the "Tools" to do "Tools \> Options \> Git " and click "Use System Git version"  
to set sourcetree to use system git?  

I have looked at ma git bash and git gui windows and could not find how to set sourcetree to use system git.

Thank you for your help.


author: nguyeag0
body: I found out I had a folder that was too large for git to handle in spite of increasing the buffer. I did not find a solution, I just removed the last commit and then commit everything but that big folder and it worked.


author: Francis Pierot
body: This solved all my problems on two projects which failed to push. Thanks a lot.


author: Mike Corsaro
body: Hello! Please see [this comment](https://community.atlassian.com/t5/Sourcetree-questions/Re-Login-popup/qaq-p/736549/comment-id/20223#M20223). It was caused by Github deprecating TLS 1.1 support, which means that all older versions of git (versions released before Jan of this year...) won't be able to connect using the Git Credential Manager for Windows. Github decided not to inform us, or otherwise email any developers about this change, so we had no idea that it was going to happen. Sorry about that!