Search code examples
gittfscloning

Cloning into ' Error encountered while cloning the remote repository: Git failed with a fatal error.Authentication failed for TFS Visual Studio 2019


To fix this error

I found a workaround. It turns out that for some (but not all) installations the RC installer is installing a prerelease version of git. You can fix the issue by installing the latest version of git over the Visual Studio copy (VS2017 does not use the git in your PATH).

Download the 32-bit version of git here: https://github.com/git-for-windows/git/releases/download/v2.11.1.windows.1/PortableGit-2.11.1-32-bit.7z.exe

Run the file you downloaded. You’ll see a popup window that asks where you’d like to unpack git to, enter this folder:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git


Solution

  • This other wait to solve too.

    Remove the TFS related credentials from Credential Manager
    In Credential Manager add the new updated Generic Credentials for the TFS account. Generally, this would overwrite the cached credentials.
    Close all Visual Studio instances, delete %LOCALAPPDATA%\.IdentityService as you did.
    Clear TFS caches %LOCALAPPDATA%\Microsoft\Team Foundation\7.0\Cache
    Clear all the browser caches especially for the stored password
    Restart Visual Studio > Team Explorer > Manage Connections to check if the Enter credential dialog popup. Just try this several times. Based on my test the dialog will popup the first time, but if you cancel it, then you have to restart VS to popup it again.
    Run Visual Studio as another user:
    
    cd C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE
    
    runas /netonly /user:<account> devenv.exe
    
    Enter the user possword, then Team Explorer > Manage Connections