Extension for Visual studio unknown error - unable

2019-03-11 09:38发布

问题:

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?

回答1:

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.



回答2:

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://login@bitbucket.org/myrepo/myproject.git to https://bitbucket.org/myrepo/myproject.git) and use Atlassian ID with full email instead.

(source)



回答3:

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



回答4:

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

https://login:pass@bitbucket.org/myrepo/myproject.git

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



回答5:

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