Configure Visual Studio to use a different Git Credential Manager for Windows
Tags: git, visualstudio2017, visualstudio2019, azuredevops
Published: 2019-08-30 20:54:18

---
title: Configure Visual Studio to use a different Git Credential Manager for Windows
published: true
tags: git,Visual Studio 2017,Visual Studio 2019,Azure DevOps
canonical_url: https://jessehouwing.net/configure-visual-studio-to-use-a-different-git-credential-manager-for-windows/
---

 ![Configure Visual Studio to use a different Git Credential Manager for Windows](https://jessehouwing.net/content/images/2019/02/9912778713_2df74a1279_k.jpg)

Visual Studio ships with the Git credential Manager for Windows (GCMW) as part of its Team Explorer feature. This nifty little helper allows you to authenticate to Azure Repos among other git providers using your normal username and password and optional 2FA and it will handle the Personal Access Token + Renewal for you. There are cases when you need a specific (usually newer) version of the GCMW.

One of those current scenarios is when you want to access a Microsoft Account backed Azure DevOps organisation using an Azure Active Directory account:

<!--kg-card-begin: image-->

![Configure Visual Studio to use a different Git Credential Manager for Windows](https://jessehouwing.net/content/images/2019/02/image.png)<figcaption>You may receive "Git failed with a fatal error. Authentication failed for ..."</figcaption>

<!--kg-card-end: image-->

Similar issues have occurred in the past while [trying to access BitBucket](https://stackoverflow.com/q/51757837/736079). The error was slightly different in this case, but the root cause was the same:

<!--kg-card-begin: code-->
```
Git failed with a fatal error.
HttpRequestException encountered.
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 Username for 'https://github.com': terminal prompts disabled.
```
<!--kg-card-end: code-->
## Solution 

In all of these cases, the recommendation is to upgrade the Git credential Manager for Windows. Many posts on Stack Overflow will tell you to overwrite the files in your Visual Studio installation with the latest files from the GCMW repository. While this usually works (I've done this myself in the past), **it can cause issues when installing a Visual Studio Update in the future.**

## A better solution

It's better to point Git to a specific version of the Git Credential Manager for Windows. First install the latest version of the Git credential Manager for Windows. [You can always find the latest version of the Git Credential Manager for Windows here](https://github.com/Microsoft/Git-Credential-Manager-for-Windows/releases). Then update your global git config:

<!--kg-card-begin: code-->
```
c:\>git config --global --edit
```
<!--kg-card-end: code-->

Find the `[credential]` section and overwrite it with (update the path to the location where `git-credential-manager.exe` is installed on your system:

<!--kg-card-begin: code-->
```
[credential]
    helper = C:\\\\Program\\ Files\\\\Git\\\\mingw64\\\\libexec\\\\git-core\\\\git-credential-manager.exe
```
<!--kg-card-end: code-->

This will ensure that all Git installations on your system will use this specific installation of GCMW.

Restart any open instances of Visual Studio and optionally clear your existing credentials from the Windows Credential Manager before trying again:

<!--kg-card-begin: image-->

![Configure Visual Studio to use a different Git Credential Manager for Windows](https://jessehouwing.net/content/images/2019/02/image-1.png)

<!--kg-card-end: image-->

When all else fails, you can turn off the Git Credential Manager completely to fall back to the default prompt-for-password behavior:

<!--kg-card-begin: code-->
```
[credential]
    helper =
```
<!--kg-card-end: code-->