Can't login to GitHub
NOTE: Updating to Visual Studio 2017 15.5.7 or later should fix this. See https://github.com/github/VisualStudio/issues/949#issuecomment-367821388
I'm having some trouble logging on to GutHib to push new changes to my repository. I've just recently upgraded to Visual Studio 17. Everything used to work on VS 2015, but doesn't any longer.
- GitHub Extension for Visual Studio version: 2.2.0.8
- Visual Studio 2017 Professional: Ver 15.0.0+26228.9
- Windows 7 Pro SP1
Detailed steps:
- I have a local clone of a public (personal) repository. I've made changes to the local files
- Staged the changes.
- Attempted to push the changes.
- The GitHub login dialog appears. I've entered my username and password. I've confirmed that these are correct by logging in to the website.
- I get the following in my ouput pane on Visual Studio
Opening repositories:
### Local path, removed the actual path to anonymise ###
Error encountered while pushing to the remote repository: Git failed with a fatal error.
fatal: AggregateException encountered.
One or more errors occurred.
error: cannot spawn askpass: No such file or directory
fatal: could not read Username for 'https://github.com': terminal prompts disabled
Pushing to https://github.com/### repo path ###.git
I have 2 factor enabled on my account.
I've tried most of the suggestion list above. I am still not able to Push. Here is the output from the extension.log:
2016-09-28 19:38:48.3619|INFO|thread: 1|RepositoryHost|Log in from cache for login 'davidehnis' to host 'https://api.github.com/' SUCCEEDED
2016-09-28 19:38:48.3799|INFO|thread: 1|RepositoryHosts|Log in to GitHub.com host 'https://api.github.com/' with username 'davidehnis' SUCCEEDED
2016-09-28 19:39:39.7486|ERROR|thread:75|PullRequestCreationViewModel|Octokit.ApiValidationException: Validation Failed
at Octokit.Connection.HandleErrors(IResponse response) in Y:\jenkins\workspace\GitHub for Visual Studio speakeasy jenkinskeep\submodules\octokit.net\Octokit\Http\Connection.cs:line 562
at Octokit.Connection.1.MoveNext() in Y:\jenkins\workspace\GitHub for Visual Studio speakeasy jenkinskeep\submodules\octokit.net\Octokit\Http\Connection.cs:line 528
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Octokit.ApiConnection.<Post>d__211.MoveNext() in Y:\jenkins\workspace\GitHub for Visual Studio speakeasy jenkinskeep\submodules\octokit.net\Octokit\Http\ApiConnection.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
at System.Reactive.PlatformServices.ExceptionServicesImpl.Rethrow(Exception exception)
at System.Reactive.ExceptionHelpers.ThrowIfNotNull(Exception exception)
at System.Reactive.Subjects.AsyncSubject1.GetResult()
at GitHub.Services.PullRequestService.<PushAndCreatePR>d__8.MoveNext() in Y:\jenkins\workspace\GitHub for Visual Studio speakeasy jenkinskeep\src\GitHub.App\Services\PullRequestService.cs:line 93
{"message":"Validation Failed","errors":[{"resource":"PullRequest","code":"custom","message":"A pull request already exists for davidehnis:Create-initial-constructs."}],"documentation_url":"https://developer.github.com/v3/pulls/#create-a-pull-request"}
2016-09-28 19:42:47.6679|ERROR|thread:53|PullRequestCreationViewModel|Octokit.ApiValidationException: Validation Failed
at Octokit.Connection.HandleErrors(IResponse response) in Y:\jenkins\workspace\GitHub for Visual Studio speakeasy jenkinskeep\submodules\octokit.net\Octokit\Http\Connection.cs:line 562
at Octokit.Connection.<RunRequest>d__52.MoveNext() in Y:\jenkins\workspace\GitHub for Visual Studio speakeasy jenkinskeep\submodules\octokit.net\Octokit\Http\Connection.cs:line 543
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Octokit.Connection.<Run>d__511.MoveNext() in Y:\jenkins\workspace\GitHub for Visual Studio speakeasy jenkinskeep\submodules\octokit.net\Octokit\Http\Connection.cs:line 528
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Octokit.ApiConnection.1.MoveNext() in Y:\jenkins\workspace\GitHub for Visual Studio speakeasy jenkinskeep\submodules\octokit.net\Octokit\Http\ApiConnection.cs:line 0
--- End of stack trace from previous location where exception was thrown ---
at System.Reactive.PlatformServices.ExceptionServicesImpl.Rethrow(Exception exception)
at System.Reactive.ExceptionHelpers.ThrowIfNotNull(Exception exception)
at System.Reactive.Subjects.AsyncSubject1.GetResult()
at GitHub.Services.PullRequestService.
Hi, I was getting the same error as the original poster (when fetching)
error: cannot spawn askpass: No such file or directory fatal: could not read Username for 'https://github.com': terminal prompts disabled
I just reverted my GitHub extension (from 2.4.2.1331 to 2.2.0.10) and I am no longer getting those errors.
I Just start getting this erros too. Only resolve to after force a logoff/login in GitHub Desktop.
@davidehnis thanks for the logs. I can't see anything in there except creating pull requests failing because of a PR already existing for the branch and then a branch not having any commits.
How were you trying to push? Was it from Team Explorer -> Sync? If so, that's part of Team Explorer and so not our extension which would explain the lack of logs. Do you think you could:
- Post a screenshot of the error, given that there's nothing in the logs
- Try pushing from the command line
This may help us diagnose the problem.
Hi, I was getting the same error as the original poster (when fetching)
error: cannot spawn askpass: No such file or directory fatal: could not read Username for 'https://github.com': terminal prompts disabled I just reverted my GitHub extension (from 2.4.2.1331 to 2.2.0.10) and I am no longer getting those errors.
Thanks for the information @vdms-mark. It's strange that reverting the GitHub extension fixed this, because as far as I can tell, this isn't happening in our code. Would you be able to upgrade back to the latest version of GitHub for Visual Studio again and see what happens? I suspect that reverting the extension might just have caused Visual Studio to fix itself...
I Just start getting this erros too. Only resolve to after force a logoff/login in GitHub Desktop.
Again, strange @rafaelsc - we shouldn't be sharing credentials with GitHub Desktop... I'm trying to work out how these separate issues and solutions fit together.
I've just come across this problem myself, and thought I'd document the cause here in case anyone else is experiencing this problem. Trying to push to a repository was showing the following error in the output pane:
error: cannot spawn askpass: No such file or directory
fatal: could not read Username for 'https://github.com': terminal prompts disabled
There were two causes for this:
- I was not already logged in via GitHub for Visual Studio
- I entered my password incorrectly
Lets look at these in detail:
I was not logged in via GitHub for Visual Studio
The following dialog was being shown:

Important: This dialog is not part of GitHub for Visual Studio, this is part of the Git Credential Manager for Windows. If you are seeing this dialog you are not signing in using GitHub for Visual Studio. Close the dialog and log in using GitHub for Visual Studio.
I entered my password incorrectly
In the above dialog, I entered my password incorrectly. When this happens, the Git Credential Manager for Windows tries to ask you for your password on the command-line. Because we're not running on the command line this fails with error: cannot spawn askpass: No such file or directory, which is a very unhelpful error message.
This error might not be caused by entering you password incorrectly - it could be caused by proxy settings etc. The fact remains, I was not signing in using GitHub for Visual Studio: instead you should log in using GitHub for Visual Studio
This is still happening to me even though iam logged in. Gonna remove 2FA I guess......
EDIT: It seems I cant because iam in a organisation that requires 2FA...Why is this being made so hard? Nice all this security locking me out of my repo...
I have the same issue without 2FA.... grrrrr
Update: I could push with github desktop when I signed out and in again, but still in visual studio it's not working.
I ran into this today. Updated to build 15.5.7 and the problem went away
Hey @Barsonax and @twixwix, updating VS to 15.5.7 should fix your login problems. Let us know.
Yes it does!
As @nimad says, if you update Visual Studio, it works
Visual Studio Enterprise build 15.5.7 also fixed the issue for me. Also updated to the latest version of the GitHub extension.
I ran to this problem just now. what just happened? 😄 🤔
Same as above, updating to 15.5.7 fixes this.
This sucks. It was working yesterday and suddenly not today. I don't have a spare hour right now to do a VS install. I'm really getting sick of all this MS BS.
Please ensure you're running VS 15.5.7 as there are some updates related to disabling weak cryptography that were rolled out today.
Updating to 15.5.7 fixed this. Thanks.
Updating to VS 15.5.7 helped me and a colleague this morning! We both had the "HttpRequestException"-version of the issue. Updating solved it immediately. Thanks to everybody who spend their time helping to find a solution.