git-credential-manager icon indicating copy to clipboard operation
git-credential-manager copied to clipboard

fatal: A task was canceled - Credentials are not added to Windows Crendential Manager

Open pc-ahrens opened this issue 2 years ago • 7 comments

Which version of GCM are you using?

$ git --version
git version 2.36.1.windows.1

Which Git host provider are you trying to connect to?

  • [ ] Azure DevOps
  • [ ] Azure DevOps Server (TFS/on-prem)
  • [ ] GitHub
  • [X] GitHub Enterprise
  • [ ] Bitbucket
  • [ ] Other - please describe

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

From a terminal, run git remote -v to see your remote URL.

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

[Azure DevOps only] What format is your remote URL?

  • [X] Not applicable
  • [ ] https://dev.azure.com/{org}/...
  • [ ] https://{org}@dev.azure.com/{org}/...
  • [ ] https://{org}.visualstudio.com/...

[Azure DevOps only] If the account picker shows more than one identity as you authenticate, check that you selected the same one that has access on the web.

  • [X] Not applicable
  • [ ] I only see one identity
  • [ ] I checked each identity and none worked

Expected behavior

I am authenticated and my Git operation completes successfully.

Actual behavior

  1. User runs git fetch origin
  2. Window pops up and user selection webflow authentication
  3. Authorization can be granted and OAuth App "Git Credential Manager" is added to GitHub profile
  4. The following error message appears on the git bash
$ git fetch origin
fatal: A task was canceled
  1. The credential were not added to the Windows Credential Manager and the connection cannot be used

In the git_trace.log the following error appears:

14:43:40.947052 ...bHostProvider.cs:288 trace: [GetSupportedAuthenticationModesAsync] Failed to query 'https://github.siemens.cloud/' for supported authentication schemes.
14:43:40.947052 ...bHostProvider.cs:289 trace: [GetSupportedAuthenticationModesAsync] ! error: 'A task was canceled.'.

Logs

Set the environment variables GCM_TRACE=1 and GIT_TRACE=1 and re-run your Git command. Review and redact any private information and attach the log. git_trace.log

pc-ahrens avatar Jul 27 '22 08:07 pc-ahrens

Quick question - are you able to access https://github.siemens.cloud/api/v3/meta from your web browser on the same machine? Are you behind a VPN that needs to be connected?

ldennington avatar Jul 27 '22 15:07 ldennington

https://github.siemens.cloud/api/v3/meta can be reached: MicrosoftTeams-image (3)

The affected user are inside a company network and access internet via proxy. There are other users inside the same network for whom it works fine. We couldn't identify significant differences between the positive and negative cases.

pc-ahrens avatar Jul 28 '22 06:07 pc-ahrens

The affected user are inside a company network and access internet via proxy. There are other users inside the same network for whom it works fine.

Have you configured Git to work with this proxy? This may explain why GCM is unable to access those addresses, but your web browser can. I do not see any proxy configuration information in the trace logs you attached.

Please can you follow these instructions to configure Git and GCM to use the proxy?

https://aka.ms/gcm/httpproxy

mjcheetham avatar Aug 01 '22 14:08 mjcheetham

Hi @mjcheetham, thanks for your response.

Proxy settings should not be required in our gitconfig. For most users (including me) it works, without a proxy for git beeing defined. We use ZScaler which serves as some kind of tunnel for outbound connections. I must admit I don't understand the details.

Interesting is the following: After step 5 in my initial issue, the following windows pop up. MicrosoftTeams-image (4) MicrosoftTeams-image (5) When the user enters his username and a personal access token as password, he can access git via https and the credentials are added to the windows credential manager.

Here is the git_trace (2).log

Best regards Per

pc-ahrens avatar Aug 08 '22 09:08 pc-ahrens

Proxy settings should not be required in our gitconfig. For most users (including me) it works, without a proxy for git beeing defined. We use ZScaler which serves as some kind of tunnel for outbound connections. I must admit I don't understand the details.

My best guess here is there's something going on that's preventing GCM (.NET application) from accessing https://github.siemens.cloud, but perhaps not Git itself (C application using cURL for networking). I'm not familiar with ZScaler or how it works.

Can you try the following from a PowerShell window please?

Invoke-WebRequest https://github.siemens.cloud/api/v3/meta

PowerShell is also a .NET application that should exhibit the same connectivity behaviours as GCM will. I'd be interested to see if this PowerShell command succeeds or times-out (like GCM).

Interesting is the following: After step 5 in my initial issue, the following windows pop up.

These windows are the basic/built-in username and password collection prompts for Git for Windows. They just take the username and password that you type in, and then pass the data to be stored directly.

GCM is different, it's not storing usernames/passwords, but instead generates OAuth access tokens and stores the token and GitHub handle. GCM attempts to access the GitHub Enterprise APIs to resolve things like authentication options and user handle. This is why GCM fails whereas the basic user/pass prompts do not.

mjcheetham avatar Aug 08 '22 14:08 mjcheetham

The PowerShell command succeeds: MicrosoftTeams-image (6)

pc-ahrens avatar Aug 09 '22 07:08 pc-ahrens

Are you able to provide a Fiddler trace? For privacy, it would probably be best to send to [email protected].

ldennington avatar Aug 10 '22 14:08 ldennington

The user installed a newer version of git for windows and the issue was solved. Thanks for your support.

pc-ahrens avatar Sep 05 '22 06:09 pc-ahrens