Problems with SourceTree.
Asked by LuisCarro:

**The problem:**   
I work with windows 10 on a 64 bit system.  
My machine broke down. At work, I was assigned to another machine that was previously used by another employee who left. That being the case, it becomes impossible for me to fetch or clone a repository.  
The message I receive is:  
remote: Invalid username or password  
fatal: Authentication failed for 'https: //Me@bitbucket.org/MyWorkSpace/MyRepo.git/'  
There is another error that strikes me in the case of cloning a repository:  
fatal: ArgumentException encountered.  
An item with the same key has already been added. (english).  
And finally a Remote button on the toolbar that includes an exclamation point, such as a warning.

![Imagen-01.png](https://community.atlassian.com/t5/image/serverpage/image-id/99623i957FBD148AADF6FD/image-size/large?v=v2&px=999 "Imagen-01.png")

If I press this button it redirects me to the bitbucket site, to the repository, but it never shows it.

**What I can do:**   
I can go to the Bitbucket site, identify myself with my credentials (it's a corporate google account) and see all my workspaves and repositories without problems.

**What I already did:**   
I have already uninstalled Bitbucket and cleaned all the git related files and folders that I found and reinstalled it again.  
I have entered Tools-\> Options -\> Authentication and registered my user with both methods: OAuth and Basic and in both cases the authentication is ok. In the case of basic authentication I have generated a password on the Bitbucket site through Personal Settings -\> App Passwords.

![Imagen-02.png](https://community.atlassian.com/t5/image/serverpage/image-id/99630i2CDC861CFA47DADD/image-size/large?v=v2&px=999 "Imagen-02.png")

![Imagen-03.png](https://community.atlassian.com/t5/image/serverpage/image-id/99631iFD7066868723CF61/image-size/large?v=v2&px=999 "Imagen-03.png")

I have entered Repository -\> Repository Settings and changed the Generic Account option to my own.

![Imagen-04.png](https://community.atlassian.com/t5/image/serverpage/image-id/99633i3C329DC2A952220A/image-size/large?v=v2&px=999 "Imagen-04.png")

<br />

In fact I am already receiving one more message: Too many invalid password attemps.

![Imagen-05.png](https://community.atlassian.com/t5/image/serverpage/image-id/99634i1904F3ABFB7F2D41/image-size/large?v=v2&px=999 "Imagen-05.png")

I have executed by command line the user registration with Git Bash: git config to set the global user,

And I don't understand what I'm doing wrong, or where to set this password. I really am lost with this.

Any help is welcome.

Thanks so much for reading.

**UPDATE:**

I can clone a repository using git bash:  
*git clone https://LuisCarro@bitbucket.org/gnloreal/tercerismo.git*

Once done I open Sourcetree and add this repository I just cloned on my machine.

<br />

If I try a fetch with sourcetree it returns several errors:

*git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks fetch*

*origin* *fatal: ArgumentException encountered.*   
*An element with the same key has already been added.*   

*remote: Invalid username or password*   
*fatal: Authentication failed for 'https: //LuisCarro@bitbucket.org/gnloreal/tercerismo.git/'*

In *Repository-\> Repository setting-\> remotes-\> origin*, the remote account is set to 'LuisCarro'

In *Tools-\> Options-\> General* the default user informacion is set to my name and email

In *Tools-\> Options-\> Authentication* :  
Hosting service: Bitbucket  
Hots url: <https://bitbucket.org>  
Preferred Protocol: HTTPSAuthentication: OAuth  
Username: LusiCarroIf I press the *Refresh OAuth Token* button a browser opens at http://localhost: 34106/?State=authenticated\&code=blablabla.

but this page is not loaded, it returns ERR_CONNECTION_RESET.  

However the *Edit Hosting Account* dialog shows *"Authentication OK"*

If I press *Set as default* , it shows a dialog that says: *"are you sure to set 'LuisCarro' as the defalt username for use with bitbucket.org when no username is included in the DVCS url?"*and i do not understand this.

Continuing with git bash, I can operate from here.  
The same fetch *(git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks fetch origin)* runs smoothly.

I can *commit, push, pull request, etc*. everything from git bash and with the same user that Sourcetree does not allow me to use.


Answers:
author: LuisCarro
body: Hi.

Finally and after some effort I managed to resolve this situation.

What I can say I did is:

* Uninstall Sourcetree.
* Search the disk for references to Sourcetree and delete all, mainly in:
  * C:\\ProgramData.
  * C:\\Users\\\<user\>\\AppData\\Local.
* Create a password in Bitbucket, at <https://bitbucket.org/account/settings/app-passwords/>.
* Create an application password referring to Sourcetree in my Google account.
* Clean the windows registry of references to Atlassian, Bitbucket and Sourcetree.
* Delete the credentials registered in windows for Bitbucket.

And I think that's it.

After all this, by installing Sourcetree I was able to register again with my Google account and access the repositories.

Some of all this worked, or maybe all at once.

I thank [@Najjar _Innovura_](/t5/user/viewprofilepage/user-id/3566624) for the collaboration.


author: Najjar _Innovura_
body: Could you check windows credentials manager. and try to update bitbucket credentials from there:

Windows Credentials Manager is the "digital locker" where Windows stores log-in credentials like usernames, passwords, and addresses.

Start -\> Search for "Windows Credentials Manager"

Look under Windows Credentials you should find butbucket there.

If the ex user username is there delete the entry and try to clone again

Hope this helps

comments: author: Najjar _Innovura_
body: Also please visit Bitbucket.org and log in using browser, it seems that it has locked your user for many authentication retries.

Bitbucket keeps your credentials safe this way so noone can keep trying to guess your password.

After the third failed authentication request Bitbucket locks your user and you will need to log in using browser


author: LuisCarro
body: Hi, thanks for your reply and sorry for the delay.

<br />

I have cleaned all existing windows credentials for sourcetree and bitbucket.  
I have restarted the pc and I have started to identify on the atlassian site.

Although I no longer have the "too many invalid password attemps" error, the problem persists and does not identify me from sourcetree.

Today my pc is under repair again, but before that I managed to fetch using git bash without problems.

again, thank you and as soon as I have my pc available again I will inform you of the progress.


Tags: authentication