Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep asking for password on Windows. #154

Closed
2 of 9 tasks
beppler opened this issue Jul 29, 2020 · 7 comments
Closed
2 of 9 tasks

Keep asking for password on Windows. #154

beppler opened this issue Jul 29, 2020 · 7 comments
Assignees
Labels
auth:basic Specific to basic authentication bug A bug in Git Credential Manager duplicate This issue or pull request already exists

Comments

@beppler
Copy link

beppler commented Jul 29, 2020

Which version of GCM Core are you using?

Git Credential Manager version 2.0.194-beta+819e6bc120 (Windows, .NET Framework 4.0.30319.42000)

Which Git host provider are you trying to connect to?

  • Azure DevOps
  • Azure DevOps Server (TFS/on-prem)
  • GitHub
  • GitHub Enterprise
  • Bitbucket
  • Other - Self hosted Gitea

Can you access the remote repository directly in the browser using the remote URL?

  • Yes
  • No, I get a permission error
  • No, for a different reason - please describe

Expected behavior

I am authenticated and my Git operation completes successfully.

Actual behavior

It authenticates, but It always ask for password using dialog.

The credential is saved to Credential Manager, but it keep asking for user and password if I run the command again.

Logs

First run

PS> git pull
14:33:12.384476 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
14:33:12.387491 git.c:444 trace: built-in: git pull
14:33:12.389490 run-command.c:663 trace: run_command: git fetch --update-head-ok
14:33:12.401132 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:33:12.403147 git.c:444 trace: built-in: git fetch --update-head-ok
14:33:12.407148 run-command.c:663 trace: run_command: GIT_DIR=.git git remote-https origin https://git.mps.com.br/carlos.beppler/containers
14:33:12.419111 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:33:12.421125 git.c:704 trace: exec: git-remote-https origin https://git.mps.com.br/carlos.beppler/containers
14:33:12.421125 run-command.c:663 trace: run_command: git-remote-https origin https://git.mps.com.br/carlos.beppler/containers
14:33:12.434093 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:33:12.629077 run-command.c:663 trace: run_command: 'git credential-manager-core get'
14:33:12.695540 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:33:12.697540 git.c:704 trace: exec: git-credential-manager-core get
14:33:12.697540 run-command.c:663 trace: run_command: git-credential-manager-core get
14:33:12.760548 ...\Application.cs:69 trace: [RunInternalAsync] Git Credential Manager version 2.0.194-beta+819e6bc120 (Windows, .NET Framework 4.0.30319.42000) 'get'
14:33:12.764550 ...\Command.cs:63 trace: [ExecuteAsync] Start 'get' command...
14:33:12.773550 ...\Command.cs:74 trace: [ExecuteAsync] Detecting host provider for input:
14:33:12.775551 ...\Command.cs:75 trace: [ExecuteAsync] protocol=https
14:33:12.775551 ...\Command.cs:75 trace: [ExecuteAsync] host=git.mps.com.br
14:33:12.778550 ...\LibGit2.cs:30 trace: [GetConfiguration] Opening default Git configuration...
14:33:12.780551 ...\LibGit2.cs:46 trace: [GetConfiguration] Adding local configuration from repository 'C:/Users/myself/containers/.git/'...
14:33:12.781550 ...\LibGit2.cs:111 trace: [.ctor] Creating Git configuration snapshot...
14:33:12.783552 ...\LibGit2.cs:139 trace: [Enumerate] Enumerating Git configuration entries...
14:33:12.784552 ...\LibGit2.cs:146 trace: [Enumerate] Enumeration complete.
14:33:12.785552 ...\LibGit2.cs:199 trace: [TryGetValue] Reading Git configuration entry 'credential.provider'...
14:33:12.786571 ...\LibGit2.cs:208 trace: [TryGetValue] No entry found.
14:33:12.787563 ...\LibGit2.cs:139 trace: [Enumerate] Enumerating Git configuration entries...
14:33:12.787563 ...\LibGit2.cs:146 trace: [Enumerate] Enumeration complete.
14:33:12.787563 ...\LibGit2.cs:199 trace: [TryGetValue] Reading Git configuration entry 'credential.authority'...
14:33:12.788551 ...\LibGit2.cs:208 trace: [TryGetValue] No entry found.
14:33:12.788551 ...viderRegistry.cs:129 trace: [GetProvider] Performing auto-detection of host provider.
14:33:12.790552 ...\Command.cs:77 trace: [ExecuteAsync] Host provider 'Generic' was selected.
14:33:12.793552 ...\HostProvider.cs:104 trace: [GetCredentialAsync] Looking for existing credential in store with key 'git:https://git.mps.com.br/'...
14:33:12.794145 ...\HostProvider.cs:109 trace: [GetCredentialAsync] No existing credential found.
14:33:12.795155 ...\HostProvider.cs:112 trace: [GetCredentialAsync] Creating new credential...
14:33:12.796158 ...\LibGit2.cs:139 trace: [Enumerate] Enumerating Git configuration entries...
14:33:12.797156 ...\LibGit2.cs:146 trace: [Enumerate] Enumeration complete.
14:33:12.797156 ...\LibGit2.cs:199 trace: [TryGetValue] Reading Git configuration entry 'credential.allowWindowsAuth'...
14:33:12.797156 ...\LibGit2.cs:208 trace: [TryGetValue] No entry found.
14:33:12.798164 ...icHostProvider.cs:88 trace: [GenerateCredentialAsync] Windows Integrated Authentication detection has been disabled.
14:33:12.798164 ...icHostProvider.cs:91 trace: [GenerateCredentialAsync] Prompting for basic credentials...
14:33:12.799159 ...\LibGit2.cs:139 trace: [Enumerate] Enumerating Git configuration entries...
14:33:12.799159 ...\LibGit2.cs:146 trace: [Enumerate] Enumeration complete.
14:33:12.799159 ...\LibGit2.cs:199 trace: [TryGetValue] Reading Git configuration entry 'credential.interactive'...
14:33:12.800156 ...\LibGit2.cs:208 trace: [TryGetValue] No entry found.
14:33:18.560819 ...\HostProvider.cs:114 trace: [GetCredentialAsync] Credential created.
14:33:18.561818 ...\Command.cs:81 trace: [ExecuteAsync] End 'get' command...
14:33:18.612826 run-command.c:663 trace: run_command: 'git credential-manager-core store'
14:33:18.659833 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:33:18.661829 git.c:704 trace: exec: git-credential-manager-core store
14:33:18.661829 run-command.c:663 trace: run_command: git-credential-manager-core store
14:33:18.725838 ...\Application.cs:69 trace: [RunInternalAsync] Git Credential Manager version 2.0.194-beta+819e6bc120 (Windows, .NET Framework 4.0.30319.42000) 'store'
14:33:18.730844 ...\Command.cs:63 trace: [ExecuteAsync] Start 'store' command...
14:33:18.738839 ...\Command.cs:74 trace: [ExecuteAsync] Detecting host provider for input:
14:33:18.740840 ...\Command.cs:75 trace: [ExecuteAsync] protocol=https
14:33:18.740840 ...\Command.cs:75 trace: [ExecuteAsync] host=git.mps.com.br
14:33:18.740840 ...\Command.cs:75 trace: [ExecuteAsync] username=carlos.beppler
14:33:18.740840 ...\Command.cs:75 trace: [ExecuteAsync] password=********
14:33:18.744842 ...\LibGit2.cs:30 trace: [GetConfiguration] Opening default Git configuration...
14:33:18.746848 ...\LibGit2.cs:46 trace: [GetConfiguration] Adding local configuration from repository 'C:/Users/myself/containers/.git/'...
14:33:18.748842 ...\LibGit2.cs:111 trace: [.ctor] Creating Git configuration snapshot...
14:33:18.749842 ...\LibGit2.cs:139 trace: [Enumerate] Enumerating Git configuration entries...
14:33:18.750842 ...\LibGit2.cs:146 trace: [Enumerate] Enumeration complete.
14:33:18.752842 ...\LibGit2.cs:199 trace: [TryGetValue] Reading Git configuration entry 'credential.provider'...
14:33:18.752842 ...\LibGit2.cs:208 trace: [TryGetValue] No entry found.
14:33:18.753840 ...\LibGit2.cs:139 trace: [Enumerate] Enumerating Git configuration entries...
14:33:18.753840 ...\LibGit2.cs:146 trace: [Enumerate] Enumeration complete.
14:33:18.753840 ...\LibGit2.cs:199 trace: [TryGetValue] Reading Git configuration entry 'credential.authority'...
14:33:18.754840 ...\LibGit2.cs:208 trace: [TryGetValue] No entry found.
14:33:18.754840 ...viderRegistry.cs:129 trace: [GetProvider] Performing auto-detection of host provider.
14:33:18.755843 ...\Command.cs:77 trace: [ExecuteAsync] Host provider 'Generic' was selected.
14:33:18.756850 ...\HostProvider.cs:143 trace: [StoreCredentialAsync] Storing credential with key 'git:https://carlos.beppler@git.mps.com.br/'...
14:33:18.760851 ...\HostProvider.cs:145 trace: [StoreCredentialAsync] Credential was successfully stored.
14:33:18.760851 ...\Command.cs:81 trace: [ExecuteAsync] End 'store' command...
14:33:18.774845 run-command.c:663 trace: run_command: git rev-list --objects --stdin --not --all --quiet --alternate-refs
14:33:18.796847 run-command.c:663 trace: run_command: git rev-list --objects --stdin --not --all --quiet --alternate-refs
14:33:18.808849 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:33:18.811849 git.c:444 trace: built-in: git rev-list --objects --stdin --not --all --quiet --alternate-refs
14:33:18.829852 run-command.c:1617 run_processes_parallel: preparing to run up to 1 tasks
14:33:18.829852 run-command.c:1649 run_processes_parallel: done
14:33:18.829852 run-command.c:663 trace: run_command: git gc --auto
14:33:18.840854 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:33:18.842855 git.c:444 trace: built-in: git gc --auto
14:33:18.850855 run-command.c:663 trace: run_command: git merge FETCH_HEAD
14:33:18.862857 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:33:18.864857 git.c:444 trace: built-in: git merge FETCH_HEAD
Already up to date.

** Second run **

PS> git pull
14:37:14.921548 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
14:37:14.924547 git.c:444 trace: built-in: git pull
14:37:14.927554 run-command.c:663 trace: run_command: git fetch --update-head-ok
14:37:14.939573 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:37:14.942587 git.c:444 trace: built-in: git fetch --update-head-ok
14:37:14.945586 run-command.c:663 trace: run_command: GIT_DIR=.git git remote-https origin https://git.mps.com.br/carlos.beppler/containers
14:37:14.957584 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:37:14.959585 git.c:704 trace: exec: git-remote-https origin https://git.mps.com.br/carlos.beppler/containers
14:37:14.959585 run-command.c:663 trace: run_command: git-remote-https origin https://git.mps.com.br/carlos.beppler/containers
14:37:14.973586 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:37:15.233281 run-command.c:663 trace: run_command: 'git credential-manager-core get'
14:37:15.301848 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:37:15.303848 git.c:704 trace: exec: git-credential-manager-core get
14:37:15.303848 run-command.c:663 trace: run_command: git-credential-manager-core get
14:37:15.368848 ...\Application.cs:69 trace: [RunInternalAsync] Git Credential Manager version 2.0.194-beta+819e6bc120 (Windows, .NET Framework 4.0.30319.42000) 'get'
14:37:15.372848 ...\Command.cs:63 trace: [ExecuteAsync] Start 'get' command...
14:37:15.381848 ...\Command.cs:74 trace: [ExecuteAsync] Detecting host provider for input:
14:37:15.383848 ...\Command.cs:75 trace: [ExecuteAsync] protocol=https
14:37:15.383848 ...\Command.cs:75 trace: [ExecuteAsync] host=git.mps.com.br
14:37:15.386848 ...\LibGit2.cs:30 trace: [GetConfiguration] Opening default Git configuration...
14:37:15.388848 ...\LibGit2.cs:46 trace: [GetConfiguration] Adding local configuration from repository 'C:/Users/myself/containers/.git/'...
14:37:15.390849 ...\LibGit2.cs:111 trace: [.ctor] Creating Git configuration snapshot...
14:37:15.391849 ...\LibGit2.cs:139 trace: [Enumerate] Enumerating Git configuration entries...
14:37:15.393849 ...\LibGit2.cs:146 trace: [Enumerate] Enumeration complete.
14:37:15.395849 ...\LibGit2.cs:199 trace: [TryGetValue] Reading Git configuration entry 'credential.provider'...
14:37:15.395849 ...\LibGit2.cs:208 trace: [TryGetValue] No entry found.
14:37:15.396848 ...\LibGit2.cs:139 trace: [Enumerate] Enumerating Git configuration entries...
14:37:15.396848 ...\LibGit2.cs:146 trace: [Enumerate] Enumeration complete.
14:37:15.396848 ...\LibGit2.cs:199 trace: [TryGetValue] Reading Git configuration entry 'credential.authority'...
14:37:15.397850 ...\LibGit2.cs:208 trace: [TryGetValue] No entry found.
14:37:15.397850 ...viderRegistry.cs:129 trace: [GetProvider] Performing auto-detection of host provider.
14:37:15.398849 ...\Command.cs:77 trace: [ExecuteAsync] Host provider 'Generic' was selected.
14:37:15.401848 ...\HostProvider.cs:104 trace: [GetCredentialAsync] Looking for existing credential in store with key 'git:https://git.mps.com.br/'...
14:37:15.402851 ...\HostProvider.cs:109 trace: [GetCredentialAsync] No existing credential found.
14:37:15.403848 ...\HostProvider.cs:112 trace: [GetCredentialAsync] Creating new credential...
14:37:15.404849 ...\LibGit2.cs:139 trace: [Enumerate] Enumerating Git configuration entries...
14:37:15.405849 ...\LibGit2.cs:146 trace: [Enumerate] Enumeration complete.
14:37:15.405849 ...\LibGit2.cs:199 trace: [TryGetValue] Reading Git configuration entry 'credential.allowWindowsAuth'...
14:37:15.405849 ...\LibGit2.cs:208 trace: [TryGetValue] No entry found.
14:37:15.406848 ...icHostProvider.cs:88 trace: [GenerateCredentialAsync] Windows Integrated Authentication detection has been disabled.
14:37:15.406848 ...icHostProvider.cs:91 trace: [GenerateCredentialAsync] Prompting for basic credentials...
14:37:15.407856 ...\LibGit2.cs:139 trace: [Enumerate] Enumerating Git configuration entries...
14:37:15.407856 ...\LibGit2.cs:146 trace: [Enumerate] Enumeration complete.
14:37:15.407856 ...\LibGit2.cs:199 trace: [TryGetValue] Reading Git configuration entry 'credential.interactive'...
14:37:15.407856 ...\LibGit2.cs:208 trace: [TryGetValue] No entry found.
14:37:21.510922 ...\HostProvider.cs:114 trace: [GetCredentialAsync] Credential created.
14:37:21.511919 ...\Command.cs:81 trace: [ExecuteAsync] End 'get' command...
14:37:21.732557 run-command.c:663 trace: run_command: 'git credential-manager-core store'
14:37:21.797569 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:37:21.799568 git.c:704 trace: exec: git-credential-manager-core store
14:37:21.799568 run-command.c:663 trace: run_command: git-credential-manager-core store
14:37:21.865567 ...\Application.cs:69 trace: [RunInternalAsync] Git Credential Manager version 2.0.194-beta+819e6bc120 (Windows, .NET Framework 4.0.30319.42000) 'store'
14:37:21.869567 ...\Command.cs:63 trace: [ExecuteAsync] Start 'store' command...
14:37:21.878568 ...\Command.cs:74 trace: [ExecuteAsync] Detecting host provider for input:
14:37:21.879568 ...\Command.cs:75 trace: [ExecuteAsync] protocol=https
14:37:21.880568 ...\Command.cs:75 trace: [ExecuteAsync] host=git.mps.com.br
14:37:21.880568 ...\Command.cs:75 trace: [ExecuteAsync] username=carlos.beppler
14:37:21.880568 ...\Command.cs:75 trace: [ExecuteAsync] password=********
14:37:21.883566 ...\LibGit2.cs:30 trace: [GetConfiguration] Opening default Git configuration...
14:37:21.885567 ...\LibGit2.cs:46 trace: [GetConfiguration] Adding local configuration from repository 'C:/Users/myself/containers/.git/'...
14:37:21.886568 ...\LibGit2.cs:111 trace: [.ctor] Creating Git configuration snapshot...
14:37:21.887568 ...\LibGit2.cs:139 trace: [Enumerate] Enumerating Git configuration entries...
14:37:21.889571 ...\LibGit2.cs:146 trace: [Enumerate] Enumeration complete.
14:37:21.891570 ...\LibGit2.cs:199 trace: [TryGetValue] Reading Git configuration entry 'credential.provider'...
14:37:21.892569 ...\LibGit2.cs:208 trace: [TryGetValue] No entry found.
14:37:21.892569 ...\LibGit2.cs:139 trace: [Enumerate] Enumerating Git configuration entries...
14:37:21.892569 ...\LibGit2.cs:146 trace: [Enumerate] Enumeration complete.
14:37:21.893569 ...\LibGit2.cs:199 trace: [TryGetValue] Reading Git configuration entry 'credential.authority'...
14:37:21.893569 ...\LibGit2.cs:208 trace: [TryGetValue] No entry found.
14:37:21.893569 ...viderRegistry.cs:129 trace: [GetProvider] Performing auto-detection of host provider.
14:37:21.894568 ...\Command.cs:77 trace: [ExecuteAsync] Host provider 'Generic' was selected.
14:37:21.895568 ...\HostProvider.cs:143 trace: [StoreCredentialAsync] Storing credential with key 'git:https://carlos.beppler@git.mps.com.br/'...
14:37:21.899568 ...\HostProvider.cs:145 trace: [StoreCredentialAsync] Credential was successfully stored.
14:37:21.899568 ...\Command.cs:81 trace: [ExecuteAsync] End 'store' command...
14:37:21.912568 run-command.c:663 trace: run_command: git rev-list --objects --stdin --not --all --quiet --alternate-refs
14:37:21.933568 run-command.c:663 trace: run_command: git rev-list --objects --stdin --not --all --quiet --alternate-refs
14:37:21.945569 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:37:21.947569 git.c:444 trace: built-in: git rev-list --objects --stdin --not --all --quiet --alternate-refs
14:37:21.964569 run-command.c:1617 run_processes_parallel: preparing to run up to 1 tasks
14:37:21.964569 run-command.c:1649 run_processes_parallel: done
14:37:21.964569 run-command.c:663 trace: run_command: git gc --auto
14:37:21.976570 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:37:21.978569 git.c:444 trace: built-in: git gc --auto
14:37:21.985569 run-command.c:663 trace: run_command: git merge FETCH_HEAD
14:37:21.996568 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
14:37:21.999567 git.c:444 trace: built-in: git merge FETCH_HEAD
Already up to date.

@Regenhardt
Copy link

Got a similar problem, except for me it only re-asks for credentials on force-push.

@gabyx
Copy link

gabyx commented Aug 5, 2020

Got the same problem. Definitely a problem

@artumino
Copy link

artumino commented Aug 11, 2020

It seems like GetCommand and StoreCommand are looking for different credential keys.
When the GetCommand is executed no username is passed as a parameter which results in the get command looking for the key "git:https://hostname/". When the store command is called the username is passed as a parameter and the credentials are stored with the key "git:https://username@hostname/".
This is probably why it can't find the stored credentials, you can easily work around this issue by manually creating a key with only the hostname ("git:https://git.mps.com.br/" in this case) in the Windows Credential Manager and it should work fine until a proper fix is in place.

@ovasquez
Copy link

@artumino thanks for the workaround. I tried many things, until this solved the problem.
Quick note: the manually created credential didn't work at first because I forgot the slash at the end of the URL, probably the string comparison failed.

@mkincaid
Copy link

See also #142

@mjcheetham mjcheetham self-assigned this Aug 27, 2020
@mjcheetham mjcheetham added auth:basic Specific to basic authentication bug A bug in Git Credential Manager duplicate This issue or pull request already exists labels Aug 27, 2020
@mjcheetham
Copy link
Collaborator

Hi @beppler; everyone!

Sorry for not responding to this issue sooner. We are aware of the root cause of this problem, as outlaid in #142. (Please watch #142 for future updates on this.)

As I mention in that issue, we're looking at an overhaul of the credential store/recall so that this issue is fixed, and that we can also better support multiple users in other providers too (see #160).

Either adding a credential manually to the Windows Credential Manager without a user name, OR including the username in the remote URL are the best ways to workaround this problem until then. Apologies for the bug!

@mjcheetham
Copy link
Collaborator

Closing in favour of #142.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth:basic Specific to basic authentication bug A bug in Git Credential Manager duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

7 participants