Unable to authenticate on Windows using username/password.
Asked by Gary:

Recently, users have been running in to issues authenticating using SourceTree on Windows. In many cases, the credentials were working, and now users are either getting failed login messages, or they keep getting credential popups.


Answers:
author: Gary
body: Hi Everyone,

This post aims to cover multiple scenarios with Sourcetree.

There are a few things to unpack here:

1. There was a bug about a month ago with the GCM that is bundled with GIT for Windows:
   1. <https://github.com/Microsoft/Git-Credential-Manager-for-Windows/issues/802>
2. Bitbucket Cloud recently deprecated TLS 1.0 and TLS 1.1: <https://bitbucket.org/blog/deprecating-tlsv1-tlsv1-1-2018-12-01>
3. If you are logging in to Bitbucket Cloud specifically: With the release of [Atlassian Access](https://www.atlassian.com/enterprise/cloud/access), domains under an organization that use SAML cannot authenticate using basic username/password authentication to Bitbucket Cloud.

For #1, depending on which version of SourceTree, GCM, or GIT you are using you may be affected. The quickest way to fix this issue, is to update to latest release version of SourceTree that we released yesterday (3.0.12):

<https://downloads.atlassian.com/software/sourcetree/windows/ga/SourceTreeSetup-3.0.12.exe>

To expand on #2 a bit:

* For Git you will need at least Git 2.16 or higher as this includes Git Credential Manager 1.14.0 or higher which includes TLS 1.2 support

* For Mercurial Sourcetree for Windows 3.0.12 bundles our own Mercurial Credential Manager 1.11.96 which is TLS 1.2 compliant

Upgrading to the latest version of SourceTree should also solve this:

<https://downloads.atlassian.com/software/sourcetree/windows/ga/SourceTreeSetup-3.0.12.exe>

For #3, there are 2 options:

1. Switch over to using SSH authentication: <https://confluence.atlassian.com/bitbucket/set-up-an-ssh-key-728138079.html>
2. For HTTPS, move to using an application specific password: <https://confluence.atlassian.com/bitbucket/app-passwords-828781300.html>

Thank you,

Gary

comments: author: John Fricker
body: 1. I've no idea about this. I'm just using the Git version installed with SourceTree, so I assume SourceTree handles updating it.  

EDIT: I found out from another post that SourceTree doesn't automatically update it. I went to the Git tab and clicked "Update embedded" which presented the error (after the "extracting" phase had started) stating: "Download either failed or was cancelled, please try again later." This doesn't seem like an option.

2. I'm not affected by this.

3. I'm intermittently getting issues: either 403 forbidden, too many login attempts, or plain old success. My regular password sometimes works, and my attempts with an application specific password yesterday simply didn't work.

This issue has made SourceTree almost completely unusable for me. It's disappointing that core functionality keeps getting broken. I used to be able to use SSH until I upgraded to Sourcetree 3.x.x, that now doesn't work despite Pageant being installed, running, and with the key added to Pageant. I tried this again yesterday to workaround the issues you described, but it's still broken so I can't use that. When I upgraded to 3.x.x, I switched to HTTPS after failing to get the SSH issues resolved, and now I can't use that either, apparently.

The weirdest part of all of this? After several successful operations (pull, push, fetch, etc.), I suddenly get hit with a "too many login attempts" message, even though all previous operations were successful.


author: Ivan Nikitin
body: Unfortunately, these suggestions do not work for me either. I'm using BitBucket Cloud Git over HTTPS. SourceTree version is 3.0.12. If I use embedded Git (2.18.0), the login dialog doesn't accept neither my account password, neither app password. If I use standalone Git 2.19.1, I'm not asked for a password, but the pull still fails with the following error:

fatal: ArgumentException encountered.  
An item with the same key has already been added.

fatal: ArgumentException encountered.  
An item with the same key has already been added.

remote: Invalid username or password  
fatal: Authentication failed fo ....

Any other suggestions?