Git-credential-manager-for-windows: Task cancelled exception: A task was cancelled.

Created on 31 May 2017  路  36Comments  路  Source: microsoft/Git-Credential-Manager-for-Windows

issue

Started happening to our entire dev team this morning.

bug more-info-needed

Most helpful comment

@simonech excellent to hear, thanks for the help with troubleshooting!

cc @cottsak

All 36 comments

Yuck. 馃あ looks like the trace functionality failed, which likely means that what ever you were tracing to got opened in exclusive mode by another process.

Do you have GCM_TRACE set in your environment? If so, to what value and what else could be reading that file (including antimalware services)?

fatal: TaskCanceledException encountered.
A task was canceled.

I got this error as well, please help

me to, starting getting this issue. not sure what cause it

@TangeniThePyGuru @memordial can either of you reproduce the issue with GCM_TRACE=%UserProfile%\git.log and GIT_TRACE=%UserProfile%\git.log in your environment variables? This ought to help identify the root cause of the issue and unblock finding a solution. Thanks!

I'm still having this proxy issue and I believe the reason most folks who encountered https://github.com/Microsoft/Git-Credential-Manager-for-Windows/issues/555, updated their windows git client, and then moved on is because the creds in the Windows Credential Manager were simply passed and GCM didn't need to get involved in generating a new Personal Access Token.

command line

I've tested this by removing my Github token from Cred Manager forcing GCM to generate a new one and store it. It seems that GCM can't use the proxy set in my .gitconfig. When I connect thorugh to the internet without a proxy I get the username and password workflow, with the 2FA sms, and everything works. With the corporate proxy in the loop tho, it fails with the above terminal output just after i click OK on the git-gui--askpass login form.

Any ideas @shiftkey ?

It's like git can use the proxy but GCM can't.

@cottsak I'm not across the proxy support for GCM, and https://github.com/Microsoft/Git-Credential-Manager-for-Windows/pull/540 isn't in the latest stable version, but let's see if that helps.

Are you able to install v1.15.0-preview.1 and see if that changes the behaviour?

You can check the version you're using by running git credential-manager version

$ git credential-manager version
Git Credential Manager for Windows version 1.14.0

No luck @shiftkey :disappointed:

update didnt help

@shiftkey Emailed you the log mate

@cottsak thanks, but I'm not too familiar with the codebase here. Just trying to help out.

The last successful thing that occurs the message before displaying the GitHub authentication dialog here: https://github.com/Microsoft/Git-Credential-Manager-for-Windows/blob/master/GitHub.Authentication/AuthenticationPrompts.cs#L46

Here's the interesting log bit, but the actual proxy setting has been replaced with proxy:

13:40:23.523076 ...\Common.cs:636       trace: [Main] git-credential-manager (v1.15.0) 'get'
13:40:23.585475 ...\Where.cs:236        trace: [FindGitInstallations] found 1 Git installation(s).
13:40:23.601075 ...Configuration.cs:218 trace: [LoadGitConfiguration] git All config read, 28 entries.
13:40:23.601075 ...\Where.cs:236        trace: [FindGitInstallations] found 1 Git installation(s).
13:40:23.601075 ...Configuration.cs:218 trace: [LoadGitConfiguration] git All config read, 28 entries.
13:40:23.601075 ...\Common.cs:532       trace: [LoadOperationArguments] http.proxy = 'http://proxy:80'.
13:40:23.601075 ...tionArguments.cs:424 trace: [SetProxy] successfully set proxy to 'http://proxy/'.
13:40:23.616675 ...\Common.cs:80        trace: [CreateAuthentication] detecting authority type for 'https://github.com/'.
13:40:23.632275 ...uthentication.cs:130 trace: [GetAuthentication] created GitHub authentication for 'https://github.com/'.
13:40:23.632275 ...\Common.cs:147       trace: [CreateAuthentication] authority for 'https://github.com/' is GitHub.
13:40:23.694675 ...icationPrompts.cs:46 trace: [CredentialModalPrompt] prompting user for credentials for 'https://github.com/'.
13:40:51.698253 ...\Program.cs:492      trace: [Run] System.Threading.Tasks.TaskCanceledException: A task was canceled.
13:40:51.700253 ...\Common.cs:601       trace: [LogEvent] System.Threading.Tasks.TaskCanceledException: A task was canceled.
13:40:51.705253 ...\Program.cs:492      trace: [Run] fatal: TaskCanceledException encountered.
13:40:51.817253 run-command.c:627       trace: run_command: 'bash' '-c' 'cat >/dev/tty && read -r line </dev/tty && echo "$line"'
13:40:55.049434 run-command.c:627       trace: run_command: 'C:/Program Files/Git/mingw64/libexec/git-core/git-gui--askpass' 'Password for '\''https://github.com'\'': '
13:40:55.299033 git.c:344               trace: built-in: git 'rev-parse' '--git-dir' '--is-inside-git-dir' '--is-bare-repository' '--is-inside-work-tree' '--short' 'HEAD'
13:42:19.568302 git.c:344               trace: built-in: git 'rev-parse' '--git-dir' '--is-inside-git-dir' '--is-bare-repository' '--is-inside-work-tree' '--short' 'HEAD'

Thanks mate. I have a workaround:

  • use a different access point at work here which doesn't use the proxy. this way GCM seemingly acquires a new access token and stores it.
  • then future requests to github with the proxy in between seem to work fine by passing the access token for auth

This suggests to me that the GCM can't use the proxy. But I don't have time to debug this further.

Hope this helps someone else.

@cottsak a bug was found in v1.14.0 of the GCM which has been fixed in v1.15.0 (once it becomes available).

@whoisj well I tried the preview build of 1.15.0 https://github.com/Microsoft/Git-Credential-Manager-for-Windows/issues/435#issuecomment-368722845 and that didn't help.

Do I need to build from source?

@cottsak you shouldn't need to, but trying isn't a bad idea.

Can you capture the trace logs again with the updated version?

I've a very similar problem.
When I try to connect to github on private repos, I get the username and password window, but I don't get the window where I can enter the 2FA token.
I'm also behind a proxy, so this might be the issue. Usually I need to tell all proxies to ignore invalid ssl certificates (silly proxy does rewrites them) but didn't find a way to configure sslVerify = false for the GCM

Cloning a project I get:

git clone ....
fatal: TaskCanceledException encountered.
   A task was canceled.
fatal: TaskCanceledException encountered.
   A task was canceled.
Username for 'https://github.com': simonech
Password for 'https://[email protected]':
remote: Invalid username or password.
fatal: Authentication failed for 'https://github.com/simonech/...'

Here is the content of the log files

18:31:00.170405 git.c:344               trace: built-in: git 'clone' 'https://github.com/simonech/...'
18:31:00.234949 run-command.c:627       trace: run_command: 'remote-https' 'origin' 'https://github.com/simonech/...'
18:31:00.253964 git.c:576               trace: exec: 'git-remote-https' 'origin' 'https://github.com/simonech/newsroom-angular'
18:31:00.254950 run-command.c:627       trace: run_command: 'git-remote-https' 'origin' 'https://github.com/simonech/newsroom-angular'
18:31:01.417401 run-command.c:627       trace: run_command: 'git credential-manager get'
18:31:01.518666 git.c:576               trace: exec: 'git-credential-manager' 'get'
18:31:01.519665 run-command.c:627       trace: run_command: 'git-credential-manager' 'get'
18:31:01.624946 ...\Common.cs:636       trace: [Main] git-credential-manager (v1.15.0) 'get'
18:31:01.696947 ...\Where.cs:236        trace: [FindGitInstallations] found 2 Git installation(s).
18:31:01.702947 ...Configuration.cs:218 trace: [LoadGitConfiguration] git All config read, 34 entries.
18:31:01.704946 ...\Where.cs:236        trace: [FindGitInstallations] found 2 Git installation(s).
18:31:01.706947 ...Configuration.cs:218 trace: [LoadGitConfiguration] git All config read, 34 entries.
18:31:01.710946 ...\Common.cs:505       trace: [LoadOperationArguments] httpProxy = 'http://proxy.consilium.eu.int:8080'.
18:31:01.711946 ...tionArguments.cs:424 trace: [SetProxy] successfully set proxy to 'http://proxy.consilium.eu.int:8080/'.
18:31:01.735945 ...\Common.cs:80        trace: [CreateAuthentication] detecting authority type for 'https://github.com/'.
18:31:01.749946 ...uthentication.cs:130 trace: [GetAuthentication] created GitHub authentication for 'https://github.com/'.
18:31:01.749946 ...\Common.cs:147       trace: [CreateAuthentication] authority for 'https://github.com/' is GitHub.
18:31:01.797948 ...icationPrompts.cs:46 trace: [CredentialModalPrompt] prompting user for credentials for 'https://github.com/'.
18:31:23.938813 ...\Program.cs:492      trace: [Run] System.Threading.Tasks.TaskCanceledException: A task was canceled.
18:31:23.939815 ...\Common.cs:601       trace: [LogEvent] System.Threading.Tasks.TaskCanceledException: A task was canceled.
18:31:23.945816 ...\Program.cs:492      trace: [Run] fatal: TaskCanceledException encountered.
   A task was canceled.
18:31:24.000815 run-command.c:627       trace: run_command: 'git credential-manager get'
18:31:24.067811 git.c:576               trace: exec: 'git-credential-manager' 'get'
18:31:24.068812 run-command.c:627       trace: run_command: 'git-credential-manager' 'get'
18:31:24.182814 ...\Common.cs:636       trace: [Main] git-credential-manager (v1.15.0) 'get'
18:31:24.257813 ...\Where.cs:236        trace: [FindGitInstallations] found 2 Git installation(s).
18:31:24.263813 ...Configuration.cs:218 trace: [LoadGitConfiguration] git All config read, 34 entries.
18:31:24.266813 ...\Where.cs:236        trace: [FindGitInstallations] found 2 Git installation(s).
18:31:24.267814 ...Configuration.cs:218 trace: [LoadGitConfiguration] git All config read, 34 entries.
18:31:24.272813 ...\Common.cs:505       trace: [LoadOperationArguments] httpProxy = 'http://proxy.consilium.eu.int:8080'.
18:31:24.272813 ...tionArguments.cs:424 trace: [SetProxy] successfully set proxy to 'http://proxy.consilium.eu.int:8080/'.
18:31:24.300812 ...\Common.cs:80        trace: [CreateAuthentication] detecting authority type for 'https://github.com/'.
18:31:24.315819 ...uthentication.cs:130 trace: [GetAuthentication] created GitHub authentication for 'https://github.com/'.
18:31:24.315819 ...\Common.cs:147       trace: [CreateAuthentication] authority for 'https://github.com/' is GitHub.
18:31:24.364827 ...icationPrompts.cs:46 trace: [CredentialModalPrompt] prompting user for credentials for 'https://github.com/'.
18:31:47.252174 ...\Program.cs:492      trace: [Run] System.Threading.Tasks.TaskCanceledException: A task was canceled.
18:31:47.253172 ...\Common.cs:601       trace: [LogEvent] System.Threading.Tasks.TaskCanceledException: A task was canceled.
18:31:47.256173 ...\Program.cs:492      trace: [Run] fatal: TaskCanceledException encountered.
   A task was canceled.
18:31:47.287171 run-command.c:627       trace: run_command: 'bash' '-c' 'cat >/dev/tty && read -r line </dev/tty && echo "$line"'
18:32:20.893024 run-command.c:627       trace: run_command: 'bash' '-c' 'cat >/dev/tty && read -r -s line </dev/tty && echo "$line" && echo >/dev/tty'
18:32:24.589432 run-command.c:627       trace: run_command: 'git credential-manager erase'
18:32:24.675996 git.c:576               trace: exec: 'git-credential-manager' 'erase'
18:32:24.676996 run-command.c:627       trace: run_command: 'git-credential-manager' 'erase'
18:32:24.772000 ...\Common.cs:636       trace: [Main] git-credential-manager (v1.15.0) 'erase'
18:32:24.841001 ...\Where.cs:236        trace: [FindGitInstallations] found 2 Git installation(s).
18:32:24.846002 ...Configuration.cs:218 trace: [LoadGitConfiguration] git All config read, 34 entries.
18:32:24.849001 ...\Where.cs:236        trace: [FindGitInstallations] found 2 Git installation(s).
18:32:24.850003 ...Configuration.cs:218 trace: [LoadGitConfiguration] git All config read, 34 entries.
18:32:24.855001 ...\Common.cs:505       trace: [LoadOperationArguments] httpProxy = 'http://proxy.consilium.eu.int:8080'.
18:32:24.855001 ...tionArguments.cs:424 trace: [SetProxy] successfully set proxy to 'http://proxy.consilium.eu.int:8080/'.
18:32:24.874998 ...\Common.cs:80        trace: [CreateAuthentication] detecting authority type for 'https://[email protected]/'.
18:32:24.888998 ...uthentication.cs:130 trace: [GetAuthentication] created GitHub authentication for 'https://[email protected]/'.
18:32:24.888998 ...\Common.cs:147       trace: [CreateAuthentication] authority for 'https://[email protected]/' is GitHub.
18:32:24.888998 ...\Common.cs:213       trace: [DeleteCredentials] deleting GitHub credentials for 'https://[email protected]/'.
18:32:24.908003 run-command.c:627       trace: run_command: 'git credential-manager erase'
18:32:24.963004 git.c:576               trace: exec: 'git-credential-manager' 'erase'
18:32:24.964004 run-command.c:627       trace: run_command: 'git-credential-manager' 'erase'
18:32:25.072001 ...\Common.cs:636       trace: [Main] git-credential-manager (v1.15.0) 'erase'
18:32:25.142003 ...\Where.cs:236        trace: [FindGitInstallations] found 2 Git installation(s).
18:32:25.147002 ...Configuration.cs:218 trace: [LoadGitConfiguration] git All config read, 34 entries.
18:32:25.150002 ...\Where.cs:236        trace: [FindGitInstallations] found 2 Git installation(s).
18:32:25.151003 ...Configuration.cs:218 trace: [LoadGitConfiguration] git All config read, 34 entries.
18:32:25.156004 ...\Common.cs:505       trace: [LoadOperationArguments] httpProxy = 'http://proxy.consilium.eu.int:8080'.
18:32:25.156004 ...tionArguments.cs:424 trace: [SetProxy] successfully set proxy to 'http://proxy.consilium.eu.int:8080/'.
18:32:25.176007 ...\Common.cs:80        trace: [CreateAuthentication] detecting authority type for 'https://[email protected]/'.
18:32:25.190007 ...uthentication.cs:130 trace: [GetAuthentication] created GitHub authentication for 'https://[email protected]/'.
18:32:25.190007 ...\Common.cs:147       trace: [CreateAuthentication] authority for 'https://[email protected]/' is GitHub.
18:32:25.190007 ...\Common.cs:213       trace: [DeleteCredentials] deleting GitHub credentials for 'https://[email protected]/'.
18:31:24.364827 ...icationPrompts.cs:46 trace: [CredentialModalPrompt] prompting user for credentials for 'https://github.com/'.
18:31:47.252174 ...\Program.cs:492      trace: [Run] System.Threading.Tasks.TaskCanceledException: A task was canceled.

This would indicate that a modal dialog was opened asking you for input and it was closed before the input was completed. Is there any indication of this happening (sorry if you mentioned it above, I'm current pressed for time and taking shortcuts)?

Yeah, the github dialog opens up, I enter username and password, press login. It closes, opens again, do it again, then it asks to enter credentials on the git cmd. And then it ends.
But before it was asking for the 2FA token once the username and password were validated. My bet is that username and password never get to github due to some proxy issue (as I mentioned the sslVerify=false not being honoured). But what happens in the modal dialog doesn't get logged.

@shiftkey this sounds very much like a bug in the GitHub dialog. Any chance this is something you can dig into?

@whoisj I'm still buried in post-summit work and upcoming jetlag, so it's going to be a week or so. Also, the involvement of a proxy to reproduce the issue will take time.

@shiftkey I can help debugging/tracing on my environment if needed. I'll see if I can find a way to debug it in VS and see where it fails.

@simonech yeah, if someone is able to debug into _where_ the GitHub integration is crashing (maybe drop a debug build into the install location with Debugger.Break enabled?) I can help to reason about what's happening.

@shiftkey I'll do it tomorrow at work (almost midnight now in Belgium)

I added Debugger.Break() in my code but it never opens the debugger.
But by putting a debug version I guess I get some additional tracing and I get this error.
Basically I get a 404 when the authorization request with username and password is sent.

16:33:33.598680 ...icationPrompts.cs:50 trace: [CredentialModalPrompt] prompting user for credentials for 'https://github.com/'.
16:33:44.621827 ...\Authority.cs:94     trace: [AcquireToken] **server responded with NotFound.**
16:33:44.621827 ...\Authority.cs:163    trace: [AcquireToken] authentication failed for 'https://github.com/'.
16:33:44.627833 ...uthentication.cs:235 trace: [InteractiveLogon] interactive logon for 'https://github.com/' failed.

@simonech that second trace message is this line which seems to suggest the targetUri is not correct, and GitHub is returning a 404 - which would explain the failure.

This area is probably where I'd try and break into with a debugger, to see if we can work out what this targetUri looks like.

@shiftkey I tried on a machine not behind proxy. Also there I get the same problem. (NotFound)
But with version 1.14.0 it is working, just not with master HEAD.
I guess some regression bug.

This is the trace with 1.14.0

00:21:40.495658 ...uthentication.cs:132 trace: [GetAuthentication] created GitHub authentication for 'https://github.com/'.
00:21:40.495658 ...\Common.cs:142       trace: [CreateAuthentication] authority for 'https://github.com/' is GitHub.
00:21:40.526661 ...icationPrompts.cs:46 trace: [CredentialModalPrompt] prompting user for credentials for 'https://github.com/'.
00:21:52.054104 ...\Authority.cs:127    trace: [AcquireToken] server responded with Unauthorized.

While this is the trace for 1.15

00:26:13.587659 ...\Common.cs:155       trace: [CreateAuthentication] authority for 'https://github.com/' is GitHub.
00:26:13.618942 ...icationPrompts.cs:50 trace: [CredentialModalPrompt] prompting user for credentials for 'https://github.com/'.
00:26:26.459257 ...\Authority.cs:94     trace: [AcquireToken] server responded with NotFound.
00:26:26.460280 ...\Authority.cs:163    trace: [AcquireToken] authentication failed for 'https://github.com/'.

The targetUrl is https://github.com/ but the problem is that the endpoint called finally is still https://github.com/while it should be the authorityUrl (https://api.github.com/authorizations)

This is how it was in 1.14

@shiftkey with PR #590 merged, now it works fine. Indeed there was a bug and Github authentication could have never worked. Strange none noticed this before. I guess not many people downloaded 1.15 yet and of those, maybe none had to connect for the first time to github thus triggering the 2FA auth dialog.

@simonech excellent to hear, thanks for the help with troubleshooting!

cc @cottsak

That's awesome guys!

Thanks @simonech. I did note above "didn't need to get involved in generating a new Personal Access Token". It's not really "Strange none noticed this before" IMO, folks wouldn't have needed to generate a new PAT. The number of folks having to get a new PAT, the subset with 2FA enabled, and then those within the window of the TLS downgrade would have been few and far between.

@cottsak good I was setting up a new machine and noticed it 馃槃

@shiftkey @simonech @cottsak re:

with PR #590 merged, now it works fine. Indeed there was a bug and Github authentication could have never worked. Strange none noticed this before. I guess not many people downloaded 1.15 yet and of those, maybe none had to connect for the first time to github thus triggering the 2FA auth dialog.

The master branch is usually ahead of the current release. The issue with the requestUri not being the same as the targetUri that @simonech fixed hasn't been released. Those changes (the problem and the fix) were intended for release with v1.16.0. The most current release (v1.15.0) didn't contain the bug.

Indeed... so when trying to debug the original error I was encountering I got master and fixed a bug introduced between 1.15 was released and now.
Ahah... so basically never fixed the original error I was experiencing 馃槃

I guess I'd have to retry with 1.15 and see if I get the same errors

This issue should be generally resolved in v1.16.0.

still having the same issue with v.1.16..2
git push --set-upstream origin codedeploy
fatal: TaskCanceledException encountered.
A task was canceled.

@cchen146 could you collect trace logs relevant to your issue? To do so, run SET GCM_TRACE=1 prior to running the Git command that fails. Thanks.

Hi. I have a similar problem.

14:32:54.286402 run-command.c:662 trace: run_command: git-credential-manager get
14:32:54.361789 ...\Common.cs:744 trace: [Main] git-credential-manager (v1.20.0) 'get'
14:32:54.423723 ...\Git\Where.cs:348 trace: [FindGitInstallations] found 1 Git installation(s).
14:32:54.429208 ...Configuration.cs:222 trace: [LoadGitConfiguration] git All config read, 32 entries.
14:32:54.479174 ...\Common.cs:85 trace: [CreateAuthentication] detecting authority type for 'https://github.com/'.
14:32:54.491940 ...uthentication.cs:151 trace: [GetAuthentication] created GitHub authentication for 'https://github.com/'.
14:32:54.492449 ...\Common.cs:176 trace: [CreateAuthentication] authority for 'https://github.com/' is GitHub.
14:32:54.492449 ...\Common.cs:765 trace: [QueryCredentials] querying 'GitHub' for credentials.
14:32:54.632822 ...icationPrompts.cs:50 trace: [CredentialModalPrompt] prompting user for credentials for 'https://github.com/'.
14:33:12.607100 ...\Authority.cs:101 trace: [AcquireToken] server responded with Created.
14:33:12.609183 ...\Authority.cs:125 trace: [AcquireToken] authentication success: new personal access token for 'https://github.com/' created.
14:33:12.610209 ...uthentication.cs:201 trace: [InteractiveLogon] token acquisition for 'https://github.com/' succeeded
14:33:27.633135 ...\Program.cs:601 trace: [Run] ! error: 'A task was canceled.'.
14:33:27.634255 ...\Common.cs:709 trace: [LogEvent] System.Threading.Tasks.TaskCanceledException: A task was canceled.
14:33:27.639306 ...\Program.cs:601 trace: [Run] fatal: TaskCanceledException encountered.
A task was canceled.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thedavidscherer picture thedavidscherer  路  21Comments

pentop picture pentop  路  38Comments

GorvGoyl picture GorvGoyl  路  22Comments

omatrot picture omatrot  路  39Comments

pfmoore picture pfmoore  路  57Comments