I'm working in SourceTree and I cannot clone my repository. Here's what I enter into the dialog:
But it tells me "This is not a valid source path / URL". When I click on the Details button, it tells me "Invalid username or password...".
I have confirmed that the url is correct and that my username is correct. I'm trying to figure out how to supply the password. Can you please help me figure out how to supply the password.
I updated to the latest version of SourceTree. In addition to that, I entered the URL without my username. This time it prompted me for login credentials.
But now my login credentials won't work! I keeps re-prompting me! I should enter the same login credentials that I use to log into my BitBucket account, shouldn't I?
The error I get is slightly different now:
Command: git -c diff.mnemonicprefix=false -c core.quotepath=false ls-remote https://email@example.com/gibran_shah/riskalive.git
Error: Logon failed, use ctrl+c to cancel basic credential prompt.
error: unable to read askpass response from 'C:\Users\gshah\AppData\Local\SourceTree\app-2.4.7\tools\Askpass.exe'
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Password for 'https://firstname.lastname@example.org/': No error
This seems to say it is trying to get the password from Askpass.exe. <-- Not sure what that it or why it's failing.
It is better to use a URL that contains you username. Sourcetree relies on Git to andle authorization. Git does that by using the Git Credential Manager, GCM, that is bundled with Git for Windows.
Git alone only has the ability to ask for a password when run from the command line, the GCM provides the popup GUI dialogs that allow git processes triggered by Sourcetree to interactively prompt the user for credentials.
The GCM stores its credentials in the Windows Credential Manager, also referred to the Vault, you can access this through Windows Settings. The GCM creates/uses entries prefixed by 'git:'.
If you use a URL without a username, e.g. https://bitbucket.org/username/myrepo, then the GCM will store credentials against git:https://bitbucket.org . This means anytime Git/GCM need to find credentials for use against bitbucket it will find and use these credentials. This works fine unitl you are using more than one account to access bitbucket. When that happens, and you are using URLs without usernames, Git/GCM will keep finding the current credentials and trying to use them, if they are correct for the repo you are trying to access they will work, if they are wrong Git/GCM will delete them, prompt you for the correct ones and then store the new ones. If you switch between repos and accounts this process will repeat endlessly.
If you use URL that do include usernames then the credentials are stored keys against, git:https://email@example.com, so each time you switch repos and accounts/usernames and you are using URLs with names Git/GCM will find the exact match.
As for Askpass.exe that should be installed at C:\Users\gshah\AppData\Local\SourceTree\app-2.4.7\tools. It is part of the Sourcetree install. Askpass.exe is a last chance fallback for authentication it should only appear if the GCM failed to get credentials it can use.
Hi Michael, thanks for the detailed feedback. I managed to solve the problem. The credentials prompt would always come up 3 times. What I didn't recognize at first was that on the third time, my username was auto-filled. This made me wonder: if it's recognizing my username on the third try, maybe it will also recognize my password. So I entered my password on the third try and presto! SourceTree has now cached my credentials and I'm able to connect to my repository automatically with my username in the url.