Unable to Authenticate
Asked by shanegoddard:

For the Love of God do NOT tell me to do all the stuff, I've already done. I've applied every fix on this site. I can log into BitBucket just fine. My account authenticates in Sourcetree just fine. I deleted ALL of my passwords in my vault... still nothing.

Here is what I have done:

I've tried the following, without success:

* removed the username from the remote URL in Repository / Repository Settings / Edit origin;
* and from the Username field;
* replaced the username with my account's email;
* removed *all* of my saved credentials from Tools / Options / Authentication;
* recreated the credentials for my Bitbucket account (which has been verified during the process);
* set said credentials as default;
* uninstalled and reinstalled SourceTree.

PUSHING does not ask for my password, why would it, it authenticates. Changing from HTTPS to SSH does nothing.

Please, Please, Please tell me what to do. Do I need a new laptop? At this point, I am ready to try. It worked fine 3 days ago, for the last 2 it has not. I have not upgraded, I changed my password in Bitbucket/Jira, and now I can't get in.

I tried basic authenication, I tried the other authenication, they both work and authenticate me... UNTIL I TRY TO DO MY JOB


Answers:
author: Mike Corsaro
body: Hello! Could you give me more details about the error you're seeing? A screenshot would be great. Thanks!

comments: author: shanegoddard
body: ![failure to authenticate.gif](https://community.atlassian.com/t5/image/serverpage/image-id/14331i061FF1B08D6084B8/image-size/large?v=v2&px=999 "failure to authenticate.gif")![Authenticate.png](https://community.atlassian.com/t5/image/serverpage/image-id/14332iF19F6BE857A4173C/image-size/large?v=v2&px=999 "Authenticate.png")


author: shanegoddard
body: I CAN get the Authentication to work using HTTPS and SSH. As well as Basic and OAuth... it authenticates there, but as soon as I try to pull OR push it fails.


author: Mike Corsaro
body: If auth fails when trying to pull or push, then it's because git is not using the correct credentials (and seeing as you've changed your password, then it probably still using the old one). I suspect that there's still some credentials in the Windows Credential Manager that's being used. Can you try the following?

* Remove any 'git' prefix credentials from the Windows Credentials Manager
* Open the command-line and run "git config --list" and verify that "credential.helper=manager" is present
* If so, then run "git credential-manager clear" which will delete all saved credentials
* Try and push again, you should now get prompted for credentials


author: shanegoddard
body: All removed...

I got the following both with --list and as seen below

<br />

C:\\Users\\sgoddard\>git config  
'git' is not recognized as an internal or external command,  
operable program or batch file.

The other git one is not going to work since git is not working

tried to push ... and same error  

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags origin master:master  
remote: Invalid username or password. If you log in via a third party service you must ensure you have an account password set in your account profile.  
fatal: Authentication failed for '<https://bitbucket.org/pgi-jira/dbdev-manual-update-scripts/>'  
Pushing to <https://bitbucket.org/pgi-jira/dbdev-manual-update-scripts>


author: Mike Corsaro
body: Seems like you don't have a system-wide install of git on your machine. That's OK: you've got 2 options:

* Install [git for windows](https://github.com/git-for-windows/git/releases/download/v2.16.1.windows.4/Git-2.16.1.4-64-bit.exe)(and make sure the setting for adding git to PATH is checked)
  * If you install git for windows system-wide, make sure the "Use system git" button is toggled in Options -\> Git
* OR, run the commands again, but make sure you directly reference the git exe, which is located in "C:\\Users\\YOUR USERNAME\\AppData\\Local\\Atlassian\\SourceTree\\git_local\\bin\\git.exe"


author: shanegoddard
body: tried the second one, and found the git.exe... but I don't have that credential manager listed.

I installed it and found the manager, and cleared it. Was SO hopeful... only to be kicked in the Jimmy.

Opened SourceTree and tried to push:

git -c diff.mnemonicprefix=false -c core.quotepath=false push -v --tags origin master:master  
remote: Invalid username or password. If you log in via a third party service you must ensure you have an account password set in your account profile.  
fatal: Authentication failed for '<https://bitbucket.org/pgi-jira/dbdev-manual-update-scripts/>'  
Pushing to <https://bitbucket.org/pgi-jira/dbdev-manual-update-scripts>


author: Mike Corsaro
body: Did you set Sourcetree to use System Git after installing it?

![systemgit.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/14465iDB8D8CAD27C71D3F/image-dimensions/511x143?v=v2 "systemgit.PNG")

If that still doesn't work, could you try adding your username to the remote repo URL?

* Open the repo
* Click "Settings"
* Double click on the origin entry
* Modify the URL / Path to include your username so that it looks something like this: "https://USERNAME@bitbucket.org/contoso/app.git"
* You should now be prompted for a password


author: shanegoddard
body: I was missing a step... I did the use System GIT and did the clean thing again, it asked for the URL, I put one of the 10 in and bam... it asked for my password.

Thank you. 3 Days of messing with this doesn't seem like a good thing. Maybe there should be an easier way for sourcetree to ... I don't know... Work?   

Thank you for your help!!!!