Git-credential-manager-for-windows: Bitbucket logon failed

Created on 5 Aug 2018  ·  16Comments  ·  Source: microsoft/Git-Credential-Manager-for-Windows

I signal a bug similar to #695 with the Bitbucket autentication.
When accessing the remote repository I'm asked with the username and pasword but they seem not to be working leding to: "Logon failed, use ctrl+c to cancel basic credential prompt.". Then the manual password prompt takes place and the same password works just fine.
On a curious note the plain Git intall (after uninstalling both git and the autenticator) seem to be working fine, it does not ask for any username or password even if I did not set up Git to store any personal information.

I'm using:

  • versison 1.17.0 of the credential manager
  • git version 2.18.0.windows.1
  • Windows 7 fully updated
  • HTTPS autentication.
bitbucket bug

Most helpful comment

v1.17.1 Preview 1 is available.

All 16 comments

@mminns @foda this is the n-th person with a problem similar to this - is there a responsiveness issue with the 2FA setup? Perhaps a bad telco route or something? Several users have reported that they're getting request timeouts during credential validation requests (other users have provided logs).

@elbal could you provide trace logging of the issue?

  1. Open Command Prompt.
  2. Run setx GIT_TRACE %UserProfile%\git.log.
  3. Run setx GCM_TRACE %UserProfile%\git.log.
  4. Restart all consoles and Git clients (SourceTree, Visual Studio, etc.).
  5. Reproduce your issue.
  6. Collect the log file from %UserProfile%\git.log.

Once you have the requested logs, please share them via this issue tracker item. As always, please remember to redact any private, secret, or personally identifiable information before sharing information on the Internet.

To disable the logging...

  1. Open Command Prompt
  2. Run setx GIT_TRACE ""
  3. Run setx GCM_TRACE ""
  4. Restart all consoles and Git clients (SourceTree, Visual Studio, etc.)

Hi @whoisj, thank you for the tip.

Here is the log:

20:13:31.968538 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
20:13:32.233738 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
20:13:32.233738 git.c:415               trace: built-in: git rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree --short HEAD
20:13:35.524559 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
20:13:35.524559 git.c:415               trace: built-in: git fetch
20:13:35.540159 run-command.c:637       trace: run_command: GIT_DIR=.git git remote-https origin https:BITBUCKET HTTPS exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
20:13:35.555760 git.c:654               trace: exec: git-remote-https origin BITBUCKET HTTPS run-command.c:637       trace: run_command: git-remote-https origin BITBUCKET HTTPS exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
20:13:37.224962 run-command.c:637       trace: run_command: 'git credential-manager get'
20:13:37.287363 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
20:13:37.302963 git.c:654               trace: exec: git-credential-manager get
20:13:37.302963 run-command.c:637       trace: run_command: git-credential-manager get
20:13:37.505763 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.0) 'get'
20:13:37.614963 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
20:13:37.630563 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 37 entries.
20:13:37.708563 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://[email protected]/'.
20:13:38.566565 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
20:13:38.566565 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://[email protected]/'  is Bitbucket.
20:13:38.597765 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://[email protected]' read from store.
20:13:38.597765 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
20:13:38.613365 ...\Authority.cs:214    trace: [ValidateCredentials] authentication type = 'Credential'.
20:13:39.362166 ...\RestClient.cs:35    trace: [TryGetUser] server responded with Unauthorized.
20:13:39.362166 ...\RestClient.cs:61    trace: [TryGetUser] authentication unauthorized
20:13:39.362166 ...\Authority.cs:225    trace: [ValidateCredentials] credential validation failed
20:13:39.362166 ...\Authority.cs:214    trace: [ValidateCredentials] authentication type = 'Token'.
20:13:39.841181 ...\RestClient.cs:35    trace: [TryGetUser] server responded with Unauthorized.
20:13:39.841181 ...\RestClient.cs:61    trace: [TryGetUser] authentication unauthorized
20:13:39.841181 ...\Authority.cs:225    trace: [ValidateCredentials] credential validation failed
20:13:40.016583 ...icationPrompts.cs:96 trace: [CredentialModalPrompt] prompting user for credentials.
20:13:56.596212 ...\RestClient.cs:35    trace: [TryGetUser] server responded with OK.
20:13:56.596212 ...\RestClient.cs:42    trace: [TryGetUser] authentication success: new password token created.
20:13:56.596212 ...\RestClient.cs:80    trace: [FindUsername] Found username [username]
20:13:56.596212 ...hAuthenticator.cs:31 trace: [GetAuthAsync] remote username [username] != [email] supplied username
20:13:56.596212 ...uthentication.cs:360 trace: [InteractiveLogon] token acquisition succeeded
20:13:56.596212 ...uthentication.cs:258 trace: [SetCredentials] Personal Access Token at https://[email protected]/
20:13:56.611812 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://[email protected]' written to store.
20:13:56.611812 ...\Authority.cs:214    trace: [ValidateCredentials] authentication type = 'Credential'.
20:13:57.095413 ...\RestClient.cs:35    trace: [TryGetUser] server responded with Unauthorized.
20:13:57.095413 ...\RestClient.cs:61    trace: [TryGetUser] authentication unauthorized
20:13:57.095413 ...\Authority.cs:225    trace: [ValidateCredentials] credential validation failed
20:13:57.095413 ...\Authority.cs:214    trace: [ValidateCredentials] authentication type = 'Token'.
20:13:57.563414 ...\RestClient.cs:35    trace: [TryGetUser] server responded with Unauthorized.
20:13:57.563414 ...\RestClient.cs:61    trace: [TryGetUser] authentication unauthorized
20:13:57.563414 ...\Authority.cs:225    trace: [ValidateCredentials] credential validation failed
20:13:57.579014 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://[email protected]/'.
20:13:57.579014 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
20:13:57.953414 run-command.c:637       trace: run_command: 'git credential-manager get'
20:13:58.015814 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
20:13:58.031414 git.c:654               trace: exec: git-credential-manager get
20:13:58.031414 run-command.c:637       trace: run_command: git-credential-manager get
20:13:58.109414 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.0) 'get'
20:13:58.187415 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
20:13:58.187415 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 37 entries.
20:13:58.249815 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://[email protected]/'.
20:13:59.092216 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
20:13:59.092216 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://[email protected]/'  is Bitbucket.
20:13:59.107816 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https://[email protected]' read from store.
20:13:59.107816 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
20:13:59.123416 ...\Authority.cs:214    trace: [ValidateCredentials] authentication type = 'Credential'.
20:13:59.779829 ...\RestClient.cs:35    trace: [TryGetUser] server responded with Unauthorized.
20:13:59.779829 ...\RestClient.cs:61    trace: [TryGetUser] authentication unauthorized
20:13:59.781829 ...\Authority.cs:225    trace: [ValidateCredentials] credential validation failed
20:13:59.782829 ...\Authority.cs:214    trace: [ValidateCredentials] authentication type = 'Token'.
20:14:00.204633 ...\RestClient.cs:35    trace: [TryGetUser] server responded with Unauthorized.
20:14:00.204633 ...\RestClient.cs:61    trace: [TryGetUser] authentication unauthorized
20:14:00.204633 ...\Authority.cs:225    trace: [ValidateCredentials] credential validation failed
20:14:00.282633 ...icationPrompts.cs:96 trace: [CredentialModalPrompt] prompting user for credentials.
20:14:16.216100 ...\RestClient.cs:35    trace: [TryGetUser] server responded with OK.
20:14:16.216100 ...\RestClient.cs:42    trace: [TryGetUser] authentication success: new password token created.
20:14:16.216100 ...\RestClient.cs:80    trace: [FindUsername] Found username [username]
20:14:16.216100 ...uthentication.cs:360 trace: [InteractiveLogon] token acquisition succeeded
20:14:16.231701 ...uthentication.cs:258 trace: [SetCredentials] Personal Access Token at https://[email protected]/
20:14:16.231701 ...seSecureStore.cs:286 trace: [WriteCredential] credentials for 'git:https://[email protected]' written to store.
20:14:16.231701 ...\Authority.cs:214    trace: [ValidateCredentials] authentication type = 'Credential'.
20:14:16.684101 ...\RestClient.cs:35    trace: [TryGetUser] server responded with Unauthorized.
20:14:16.684101 ...\RestClient.cs:61    trace: [TryGetUser] authentication unauthorized
20:14:16.684101 ...\Authority.cs:225    trace: [ValidateCredentials] credential validation failed
20:14:16.684101 ...\Authority.cs:214    trace: [ValidateCredentials] authentication type = 'Token'.
20:14:17.120902 ...\RestClient.cs:35    trace: [TryGetUser] server responded with Unauthorized.
20:14:17.136502 ...\RestClient.cs:61    trace: [TryGetUser] authentication unauthorized
20:14:17.136502 ...\Authority.cs:225    trace: [ValidateCredentials] credential validation failed
20:14:17.136502 ...\Common.cs:642       trace: [LogEvent] Failed to retrieve Bitbucket credentials for 'https://[email protected]/'.
20:14:17.136502 ...\Program.cs:415      trace: [Get] Logon failed, use ctrl+c to cancel basic credential prompt.
20:14:17.495303 run-command.c:637       trace: run_command: 'C:/Program Files/Git/mingw64/libexec/git-core/git-gui--askpass' 'Password  for '\''https://[email protected]'\'': '
20:14:23.759729 run-command.c:637       trace: run_command: 'git credential-manager store'
20:14:23.853329 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
20:14:23.853329 git.c:654               trace: exec: git-credential-manager store
20:14:23.853329 run-command.c:637       trace: run_command: git-credential-manager store
20:14:23.931329 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.0) 'store'
20:14:24.009329 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
20:14:24.024929 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 37 entries.
20:14:24.056129 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https://[email protected]/'.
20:14:24.833545 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
20:14:24.833545 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https://username @bitbucket.org/'  is Bitbucket.
20:14:24.833545 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https:// username @bitbucket.org/'.
20:14:24.848545 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https:// username @bitbucket.org' read from store.
20:14:24.849545 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
20:14:24.849545 ...uthentication.cs:221 trace: [SetCredentials] skipping for https:// username @bitbucket.org/ new username Personal Access Token != username
20:14:24.860546 run-command.c:637       trace: run_command: 'git credential-manager store'
20:14:24.898747 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
20:14:24.898747 git.c:654               trace: exec: git-credential-manager store
20:14:24.898747 run-command.c:637       trace: run_command: git-credential-manager store
20:14:24.992347 ...\Common.cs:677       trace: [Main] git-credential-manager (v1.17.0) 'store'
20:14:25.070347 ...\Git\Where.cs:361    trace: [FindGitInstallations] found 1 Git installation(s).
20:14:25.070347 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 37 entries.
20:14:25.117147 ...\Common.cs:85        trace: [CreateAuthentication] detecting authority type for 'https:// username @bitbucket.org/'.
20:14:25.897148 ...uthentication.cs:319 trace: [GetAuthentication] authentication for Bitbucket created
20:14:25.897148 ...\Common.cs:174       trace: [CreateAuthentication] authority for 'https:// username @bitbucket.org/'  is Bitbucket.
20:14:25.897148 ...\Program.cs:518      trace: [Store] storing Bitbucket credentials for 'https:// username @bitbucket.org/'.
20:14:25.928348 ...seSecureStore.cs:195 trace: [ReadCredentials] credentials for 'git:https:// username @bitbucket.org' read from store.
20:14:25.928348 ...uthentication.cs:180 trace: [GetCredentials] successfully retrieved stored credentials, updating credential cache
20:14:25.928348 ...uthentication.cs:221 trace: [SetCredentials] skipping for https:// username @bitbucket.org/ new username Personal Access Token != username
20:14:25.928348 run-command.c:637       trace: run_command: git rev-list --objects --stdin --not --all --quiet
20:14:25.959548 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
20:14:25.959548 git.c:415               trace: built-in: git rev-list --objects --stdin --not --all --quiet
20:14:25.975148 run-command.c:637       trace: run_command: git rev-list --objects --stdin --not --all --quiet
20:14:26.006348 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
20:14:26.006348 git.c:415               trace: built-in: git rev-list --objects --stdin --not --all --quiet
20:14:26.021948 run-command.c:1553      run_processes_parallel: preparing to run up to 1 tasks
20:14:26.021948 run-command.c:1585      run_processes_parallel: done
20:14:26.021948 run-command.c:637       trace: run_command: git gc --auto
20:14:26.037549 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
20:14:26.037549 git.c:415               trace: built-in: git gc --auto
20:14:26.115549 exec-cmd.c:236          trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
20:14:26.115549 git.c:415               trace: built-in: git rev-parse --git-dir --is-inside-git-dir --is-bare-repository --is-inside-work-tree --short HEAD

What happened:

  • I used the fetch command from a Git Bash I opened directly on my program folder.
  • I was prompted the Credential manager autentication already filled with my username, I added the password.
  • An error occurred in the Bash signalling the autentication did not work.
  • I was prompted the credential manager again ( without me adding any new command), this time I used my email as the username and the same password as before.
  • Same error as before.
  • I was prompted with the standard Git autentication window asking fot the password only, I used the same password as before.
  • Git was apparently able to autenticate this time and fetched the remote repository.

@mminns @foda I think the important part of the trace is here:

20:13:58.109414 [Main] git-credential-manager (v1.17.0) 'get'
20:13:58.187415 [FindGitInstallations] found 1 Git installation(s).
20:13:58.187415 [LoadGitConfiguration] git All config read, 37 entries.
20:13:58.249815 [CreateAuthentication] detecting authority type for 'https://[email protected]/'.
20:13:59.092216 [GetAuthentication] authentication for Bitbucket created
20:13:59.092216 [CreateAuthentication] authority for 'https://[email protected]/'  is Bitbucket.
20:13:59.107816 [ReadCredentials] credentials for 'git:https://[email protected]' read from store.
20:13:59.107816 [GetCredentials] successfully retrieved stored credentials, updating credential cache
20:13:59.123416 [ValidateCredentials] authentication type = 'Credential'.
20:13:59.779829 [TryGetUser] server responded with Unauthorized.
20:13:59.779829 [TryGetUser] authentication unauthorized
20:13:59.781829 [ValidateCredentials] credential validation failed
20:13:59.782829 [ValidateCredentials] authentication type = 'Token'.
20:14:00.204633 [TryGetUser] server responded with Unauthorized.
20:14:00.204633 [TryGetUser] authentication unauthorized
20:14:00.204633 [ValidateCredentials] credential validation failed
20:14:00.282633 [CredentialModalPrompt] prompting user for credentials.
20:14:16.216100 [TryGetUser] server responded with OK.
20:14:16.216100 [TryGetUser] authentication success: new password token created.
20:14:16.216100 [FindUsername] Found username [username]
20:14:16.216100 [InteractiveLogon] token acquisition succeeded
20:14:16.231701 [SetCredentials] Personal Access Token at https://[email protected]/
20:14:16.231701 [WriteCredential] credentials for 'git:https://[email protected]' written to store.
20:14:16.231701 [ValidateCredentials] authentication type = 'Credential'.
20:14:16.684101 [TryGetUser] server responded with Unauthorized.
20:14:16.684101 [TryGetUser] authentication unauthorized
20:14:16.684101 [ValidateCredentials] credential validation failed
20:14:16.684101 [ValidateCredentials] authentication type = 'Token'.
20:14:17.120902 [TryGetUser] server responded with Unauthorized.
20:14:17.136502 [TryGetUser] authentication unauthorized
20:14:17.136502 [ValidateCredentials] credential validation failed
20:14:17.136502 [LogEvent] Failed to retrieve Bitbucket credentials for 'https://[email protected]/'.
20:14:17.136502 [Get] Logon failed, use ctrl+c to cancel basic credential prompt.

Notice the number of times [ValidateCredentials] is invoked during this single execution. Any idea what is happening here?

Hmmm... looks like the 2FA token isn't ever being used. A weird part about the Bitbucket auth is that even if we have an oauth token already, we don't know if it's a basic or bearer token (in the Bitbucket project, Authority.cs on line 151 in method ValidateCredentials).

So we try basic first, then try as oauth. It looks like this isn't working because the token doesn't get handled quite right -- I think that's the problem that I mentioned in the last PR regarding adding TokenType.Personal to a switch statement in Network.cs . It looks like that change didn't get included in the cherry-pick 🙁

Version: 1.17.0

We receive __Logon failed__ error when :

$ git clone https://[email protected]/teamid/myddproject.git test3
Cloning into 'test3'...
Logon failed, use ctrl+c to cancel basic credential prompt.

But removing username the login succesfully happens and credential are stored in windows credentials :

$ git clone https://bitbucket.org/teamid/myddproject.git test3
Cloning into 'test3'...
Logon failed, use ctrl+c to cancel basic credential prompt.

Why there are so many changes for final user in a the last few weeks ?

We have many git remotes configured with bitbucket username in them, so they should be fixed in every projects?

We have many git remotes configured with bitbucket username in them, so they should be fixed in every projects?

With the fix suggested by @Foda, hopefully you will not have to.

@whoisj Hitting this since yesterday. What's the eta for fix? I have gcm 1.17.0 but still.

git version 2.18.0.windows.1
git credentials manager 1.17.0
windows 8, 10
https

edit: using 2fa so using app password.

i'm stuck on this too - what is the eta?

I found no other way then going back to file based store.

as described here: https://agilewarrior.wordpress.com/2017/09/25/how-to-setup-git-credential-store-in-windows/

Omit username in remotes

Il mer 8 ago 2018, 12:03 sr01 notifications@github.com ha scritto:

I found no other way then going back to file based store.

as described here:
https://agilewarrior.wordpress.com/2017/09/25/how-to-setup-git-credential-store-in-windows/
http://url


You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/Git-Credential-Manager-for-Windows/issues/704#issuecomment-411354550,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIkof-ZlBzkg_EWl2y5bCHJgY5kFkuhQks5uOrd6gaJpZM4VvdFT
.

Make sure you use https://[email protected] and not just username in the bitbucket login prompt.

@Foda @whoisj This is interesting, using: "https://[email protected]", as suggested by @leppie, instead of "username" in the Git Credential Manager seems to be working better as it takes me to a 2-factors autentication page.

Strange thing is I do not recall of setting up a 2-factors autentication procedure and as soon as I authorize the next page, the one that should confim the autorization has been granted, can't be reached.

So the system is still not autenticating but apparently it takes me a little further.

@elbal I built GCMW from source from the rel/1.17 branch (build attached). Not sure if that fixed it for me. I didnt have issues granting access and authenticating after.
gcmw-v1.17.0-bitbucket-fix.zip

All, @foda and are working on the fix as quickly as possible. My goal is to patch both v1.16 and v1.17 this week. (#711, #712, #713).

v1.17.1 Preview 1 is available.

If somebody still interested in the issue..
I had the same issue even in the latest Credential manager: 1.20
The reason was in the git remote add command which has been using git repository with not existed user name: https://[email protected]/...
I have removed the username prefix and it has been fixed.

Was this page helpful?
0 / 5 - 0 ratings