Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 276
User987 Avatar asked Aug 07 '18 11:08

User987


3 Answers

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

like image 156
Duke Avatar answered Oct 19 '22 22:10

Duke


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)

like image 29
Vlad Rudenko Avatar answered Oct 19 '22 22:10

Vlad Rudenko


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.

like image 25
Moon Avatar answered Oct 19 '22 20:10

Moon