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:
Similar issues have occurred in the past while trying to access BitBucket. The error was slightly different in this case, but the root cause was the same:
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.
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.
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. Then update your global git config:
c:\>git config --global --edit
[credential] section and overwrite it with (update the path to the location where
git-credential-manager.exe is installed on your system:
[credential] helper = C:\\\\Program\\ Files\\\\Git\\\\mingw64\\\\libexec\\\\git-core\\\\git-credential-manager.exe
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:
When all else fails, you can turn off the Git Credential Manager completely to fall back to the default prompt-for-password behavior:
[credential] helper =