Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot use git actions in VisualStudio (git-askpass.exe: No such file or directory)

I have been using BitBucket as my code repository with Visual Studio, but today I'm not able to push code.

I tried to fetch, it opens a window to input the BitBucket credentials (username/email and password), the window closes and VisualStudio gives an error:

Fetching from origin Error encountered while fetching: 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 'https://[email protected]': terminal prompts disabled

I tried the following but the error continues:

  • Update the Visual Studio

  • Installing the BitBucket extension for Visual Studio

  • Clearing and inserting the git credentials manually

like image 733
Edu Avatar asked Aug 19 '18 14:08

Edu


People also ask

What is git Askpass?

Git Askpass for Windows (Askpass) provides secure Git credential storage for Windows. Askpass provides multi-factor authentication support for Azure DevOps, Team Foundation Server, and GitHub.

What is git Credential Manager for Windows?

Git Credential Manager simplifies authentication with your Azure Repos Git repositories. Credential managers let you use the same credentials that you use for the Azure DevOps Services web portal. Credential managers support multi-factor authentication through Microsoft account or Azure Active Directory (Azure AD).


3 Answers

After trying different solutions for a while I found the solution in the VisualStudio forums: https://developercommunity.visualstudio.com/solutions/310409/view.html

Thanks to James Mu.

Here are the detailed steps that worked for me:

  1. Install the latest pre-release of Git Credential Manager for Windows. You can download the .exe here: https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases/tag/v1.16.3

  2. Open the folder C:\Program Files\Git\mingw64\libexec\git-core with the windows file explorer, order files by "Date modified" descending (most recent first), and copy the top 6 files to %DevEnvDir%\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\libexec\git-core.

    • For me the folder is C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\libexec\git-core.

    • If it is not for you, view the value of %DevEnvDir% with "Developer Command Prompt for VS 2017" and the "set" command.

  3. Replace the files in the destination folder.

like image 189
Edu Avatar answered Sep 21 '22 02:09

Edu


If you are still getting this error for Visual Studio 2019 and updating GCM is not working then please use app password instead of your regular BitBucket login password as of Mar 1 2022, BitBucket stopped using regular password for API based authentication. See reference

https://community.atlassian.com/t5/Bitbucket-articles/Announcement-Bitbucket-Cloud-account-password-usage-for-Git-over/ba-p/1948231

like image 32
Curious Developer Avatar answered Sep 22 '22 02:09

Curious Developer


  1. Close Visual Studio and open CMD as administrator
  2. Run this command: mklink /D "C:\Git" "C:\Program Files\Git"
  3. Open Environment Variables and add GIT_ASKPASS variable with value "C:\Git\mingw64\libexec\git-core\git-askpass.exe"
  4. Open Visual Studio and push/pull or sync!
like image 42
Morteza Amini Avatar answered Sep 21 '22 02:09

Morteza Amini