Extension for Visual studio unknown error - unable to push or fetch anything
Asked Answered
L

6

13

I have an error when I try to push anything to my bitbucket repository via Git extension for visual studio:

Error encountered while pushing branch to the remote repository: Git failed with a fatal error.
HttpRequestException encountered.
   An error occurred while sending the request.
cannot spawn /C/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git/mingw32/libexec/git-core/git-askpass.exe: No such file or directory
could not read Password for ......

What could be the issue here?

Lintwhite answered 7/8, 2018 at 11:6 Comment(4)
@JosephSerido I'm not using SSH key... commits work via gitbash...Lintwhite
It has started to happen to us too in my workplace! Using command line git works fine, but in VS it suddenly stopped working.Midmost
Related: github.com/github/VisualStudio/issues/949 Note the comments from last hours.Midmost
This solves it to me, but it's very insecure to store a password in plain text like this: github.com/github/VisualStudio/issues/…Midmost
M
4

It seems to affect some Visual Studio users since a few hours ago, even with no changes taken place in the environment prior to that. Something apparently went wrong in Git integration with Visual Studio.

There is currently a workaround, where you set the password in the remotes settings of the repository, as shown here, but note that it is insecure as it requires storing the password in plain text.

Another workaround is to work with Git using command line.

A third workaround, which I also find the best one, is to configure SSH key authentication. As of now, it seems to work with Visual Studio 2017 without any issues. This is the solution I chose.

Midmost answered 7/8, 2018 at 13:50 Comment(3)
Information on how to configure SSH key authentication appreciated - ideally pasted in here - thanks.Aurar
@Aurar confluence.atlassian.com/bitbucket/…Midmost
Thanks. My impression is that the SSH thing wont be necessary once the Extension is updated!? Anyone know if this is true or when that's likely to happen? I want to avoid going the SSH route if I don't have to, I can live without a remote source repo for a while I'm a single dev.Aurar
T
16

Reason: The same error message was when GitHub deprecated support for TLS1.0 and TLS1.1 some months ago. And now it looks like Atlassian made some changes to BitBucket's networking on 06-Aug-18 (https://blog.bitbucket.org/2018/08/06/update-ip-migration/). This change could be related to the problem.

Workaround: The bundled Git-Credential-Manager-for-Windows in Visual Studio 2017 is not of the latest release yet. Downloading the latest release and putting it on top of the files in Visual Studio 2017 fix the issue:

  1. Download the zip file gcmw-v1.16.3.zip from https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases
  2. Navigate to C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\libexec\ (or wherever your 'missing' git-askpass.exe resides)
  3. Make a backup copy of the git-core folder
  4. Put the files from the zip file on top of the contents of your new git-core folder and overwrite where prompted

Also seems you need to remove "login" from remote settings if such is configured (i.e change https://[email protected]/myrepo/myproject.git to https://bitbucket.org/myrepo/myproject.git) and use Atlassian ID with full email instead.

(source)

Treacy answered 8/8, 2018 at 12:6 Comment(2)
That last part, removing the login@ portion of the URL, was what I did not see in similar solutions. It won't work without it!Tidal
Thank you ! It works perfectly, i was messing around for 2 days and even an SSH key authentication didn't workYun
M
4

It seems to affect some Visual Studio users since a few hours ago, even with no changes taken place in the environment prior to that. Something apparently went wrong in Git integration with Visual Studio.

There is currently a workaround, where you set the password in the remotes settings of the repository, as shown here, but note that it is insecure as it requires storing the password in plain text.

Another workaround is to work with Git using command line.

A third workaround, which I also find the best one, is to configure SSH key authentication. As of now, it seems to work with Visual Studio 2017 without any issues. This is the solution I chose.

Midmost answered 7/8, 2018 at 13:50 Comment(3)
Information on how to configure SSH key authentication appreciated - ideally pasted in here - thanks.Aurar
@Aurar confluence.atlassian.com/bitbucket/…Midmost
Thanks. My impression is that the SSH thing wont be necessary once the Extension is updated!? Anyone know if this is true or when that's likely to happen? I want to avoid going the SSH route if I don't have to, I can live without a remote source repo for a while I'm a single dev.Aurar
S
4

I reported this as a bug since it just started happening to me right after updating to 15.7.6.

https://developercommunity.visualstudio.com/content/problem/307355/vs-2017-git-failed-with-a-fatal-error-after-instal.html

Selfdenial answered 7/8, 2018 at 13:58 Comment(1)
It isn't related to the update. It affects users from previous releases as well. Also, it didn't start to happen to me right after the update, but at some point later.Midmost
I
1

For now, I'm just setting my pass on my 'git clone url' and that solved my problem.

https://login:[email protected]/myrepo/myproject.git

I'm still looking for a better solution, though.

Impropriety answered 7/8, 2018 at 14:43 Comment(1)
Setting the password in plain text like this is very insecure. As I wrote in my answer, configuring SSH key authentication is the best and most secure workaround. Most Git hosting services (like GitHub and Bitbucket) support SSH authentication.Midmost
C
1

1) delete credentials in the Credential Manager

2) rename or delete the Git directory in "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/Common7/IDE/CommonExtensions/Microsoft/TeamFoundation/Team Explorer/Git"

3) install the package "https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/tag/v1.17.0"

4) when VS ask for the BitBucket / GitHub credential insert them

Chitarrone answered 9/8, 2018 at 9:45 Comment(0)
D
0

I had the same issue. The error comes when the visual studio is trying to login to GitHub.
Get the Git for windows :
https://git-scm.com/download/win

This will install the git bash and GUI for windows.
Open git bash
Go to an existing repo and try to do a pull(>>git pull) or, try to do a git clone (>>git clone someurl
This will trigger and ask for git credentials in a web browser.
Just enter the credential and login
If the login is successful, try to do a pull from the visual studio. It should work fine.

Doerrer answered 21/12, 2020 at 19:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.