Visual Studio 2017 - Git failed with a fatal error

270,804

Solution 1

After I changed the generic credentials from Control PanelUser AccountsCredential Manager for Git, it worked for me.

Enter image description here

Solution 2

I'm going to add a solution here that the previous answers have not already mentioned, but this is what fixed it for me.

  1. Navigate to C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\ and delete the Git folder.

  2. Make sure that there is no version of Git installed on your system, remove it by going to Control PanelProgram and Features (TortoiseGit does not need to be removed from my experience, just native git installations).

  3. Open up the Visual Studio 2017 installer and untick "Git For Windows" in installation options.

  4. Head over to the Git website and install the latest version of Git for Windows.

  5. Go back into the Visual Studio installer and tick "Git for Windows" again. It will not download a new version even though it may look like it is. After that is done, your Git should be fine with VSTS and TF Explorer.

Solution 3

I had a different problem. My computer contained older OpenSSL DLL files in system32 and syswow64 so to fix my problem, I had to copy libeay32.dll and ssleay32.dll from one folder to another folder within the Git folders of Visual Studio 2017.

FROM: C:\Program Files (x86)\Microsoft Visual Studio\2017\vs_edition\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin\

TO: C:\Program Files (x86)\Microsoft Visual Studio\2017\vs_edition\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\libexec\git-core

Ref.: Git - Can't clone remote repository

Solution 4

In Control Panel\All Control Panel Items\Credential Manager ==> Windows Credentials Remove Git:http://........

and Retry..

Enjoy !

Solution 5

I tried a lot and finally got it working with some modification from what I read in Git - Can't clone remote repository:

  1. Modify Visual Studio 2017 CE installation → remove Git for windows (installer → modify → single components).

  2. Delete everything from C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git.

  3. Modify Visual Studio 2017 CE installation → add Git for windows (installer → modify → single components)

  4. Install Git on windows (32 or 64 bit version), having Git in system path configured.

Maybe point 2 and 3 are not needed; I didn't try.

Now it works OK on my Gogs.

Share:
270,804

Related videos on Youtube

sham
Author by

sham

Updated on July 09, 2022

Comments

  • sham
    sham almost 2 years

    I am using Visual Studio 2017 Community Edition (CE), and I have signed into my Microsoft account and I am connected to VSTS. I can see all my projects and repositories, but when I attempt to pull/fetch/push any changes I get the following error:

    Error encountered while pushing to the remote repository: Git failed with a fatal error.
    PushCommand.ExecutePushCommand
    

    And accordingly for the fetch and pull commands too.

    I installed Git for Windows on the Visual Studio 2017 installer and not only is it failing to work with VSTS, I am unable to work with any of my GitHub repositories too. Has anyone else noticed this? It's happened on two of my machines so far.

    Visual Studio 2015 Enterprise Edition (EE) and CE work completely fine for me.

    It seems that this issue has gotten far more recognition that I thought it would which leads me to believe that this is an issue with how Visual Studio is dealing with Git. I have also noticed that every time I update Visual Studio, this problem pops back up, and I have to go through the steps in some of the answers below to get Git working again. I'm not sure why this is happening, and I also don't know if Microsoft are planning to resolving this issue.

    • GorvGoyl
      GorvGoyl about 7 years
      did u find any solution?
    • Royi Mindel
      Royi Mindel almost 7 years
      try going to the solution folder in cmd and using git push to see the actual error, I had the same issue, tried many thing, the command line gave me the actual reason for the failure (I marked my email as private in github and it was conflicting with the push details as it would make my email visible in the code change)
    • Daniel Bailey
      Daniel Bailey over 5 years
      I was also getting all sorts of errors, fixed them all by just updating the GitHub extension in Tools > Extensions & Updates.
  • Bill Noel
    Bill Noel about 7 years
    I have two machines. Both have VS2017RTM on them. Same version of VS and same version of GitHub.VisualStudio. Neither TeamExplorer folder has a Git folder in it. One works and one doesn't. :(
  • StingyJack
    StingyJack about 7 years
    This worked for me, but where the heck did you find the clue?
  • cvocvo
    cvocvo about 7 years
    Same trick works for 'Professional', copy the dll's, close VS instances, reopen one and try to close again.
  • Riki
    Riki about 7 years
    Those were not the only files that were missing for me. This link describes how to find out what you have to copy. developercommunity.visualstudio.com/content/problem/27220/…
  • tsalaroth
    tsalaroth about 7 years
    This may well be the solution we're all looking for! Thank you!
  • Ogglas
    Ogglas almost 7 years
    Worked for me, Error: Error encountered while cloning the remote repository: Git failed with a fatal error. CloneCommand.ExecuteClone
  • benichka
    benichka almost 7 years
    Worked for me, but just after 1 I also uninstalled Git for Windows in the program list for my PC.
  • SvenAelterman
    SvenAelterman almost 7 years
    This was my problem too. I had to uncheck the Block command line pushes that expose my email setting, push commits that were pending. Then I configured my GitHub no-reply email address in git global config. Any future commits were then associated with that email and can now be pushed even with the Block command line pushes that expose my email turned on again.
  • Lance Larsen - Microsoft MVP
    Lance Larsen - Microsoft MVP almost 7 years
    Awesome, totally worked - wouldn't have thought of this in a million years - huge kudos!
  • jaredbaszler
    jaredbaszler over 6 years
    Mine was similar to this. I was having an issue where the newer version of VS 2017 (15.3.2) was all of a sudden constantly making me check in this odd storage.ide file. I had to keep committing that file after closing/opening VS and that finally worked. Disclaimer - I also completed the steps in the most accepted answer above as well.
  • Jude
    Jude over 6 years
    I just noticed that all files I committed, was still under "Changes". I recommitted them. And problem's gone away.
  • Tomas Dittmann
    Tomas Dittmann over 6 years
    I already had git for windows installed. Executing step 1 and step 5 did it for me.
  • PhatBuck
    PhatBuck over 6 years
    Ahem - or Enterprise instead of Community in the above path ;-)
  • Tun
    Tun about 6 years
    @Douglas you're absolutely right. I followed what you mentioned. It fixes the problem.
  • Esen
    Esen about 6 years
    Thank you this solved my issue. I changed my domain username password and before I did, i had uncommitted changes. When used git pull, it shows change username password popup which helped me understand what was the problem. Then I did git reset to lose all the previous change and then it solved my problem in Visual studio
  • qxotk
    qxotk almost 6 years
    On Step 4 - does it matter whether one installs 32-bit of 64-bit Git for Windows?
  • qxotk
    qxotk almost 6 years
    On Step 4 I used 64-bit Git for Windows and this worked for me. My VS2017 15.7.3 can once again push to my remote without getting this error.
  • Peter Mortensen
    Peter Mortensen almost 6 years
    Re TF Explorer: Do you mean Team Explorer?
  • user15741
    user15741 almost 6 years
    Git OpenSSL or native Windows Secure Channel?
  • Steve Kennedy
    Steve Kennedy almost 6 years
    This worked for me. Seemed like the easiest of all the suggested solutions too.
  • Steve Kennedy
    Steve Kennedy almost 6 years
    This worked for me. Seemed like the easiest of all the suggested solutions too
  • wbing520
    wbing520 almost 6 years
    Glad it helps. Could you please vote it if it helps? It may help others. Thanks!
  • HackSlash
    HackSlash over 5 years
    VS is incapable of making a new remote origin. This is the only thing that works for me. You do the initial push to the remote on the command line or with Tortoise and then VS can use it.
  • Enno
    Enno over 5 years
    This worked for me. So it looks like the version of Git that MS ships is bad, and replacing it with the official Git for Windows release fixes the problem - just make sure it's in the PATH, and the only version of git that is installed. I think we're finally migrating to VS2017.
  • CScott
    CScott over 5 years
    Solved my issue as well. I was getting "Git failed with a fatal error. Authentication failed for <TFS path>". I deleted the git item from Credential Manager and was prompted for my new password next time I tried a push from VS
  • Sherwin
    Sherwin over 5 years
    Thanks for this. Solved my GIt issue in latest updated VS2017
  • Kundan Vuppala
    Kundan Vuppala over 5 years
    I just removed the git links under generic credentials, it worked.
  • markzzz
    markzzz over 5 years
    This seems to be the smartest solution! Thank you ;)
  • Anthony Elliott
    Anthony Elliott over 5 years
    While committing before reverting does prevent you from losing data, that doesn't answer the OP's question. That would be a good fit for a comment though!
  • Cᴏʀʏ
    Cᴏʀʏ over 5 years
    I'm here due to the flashing console windows issue that the steps above fix. Visual Studio 15.9.7 broke Git again, but this fix still works.
  • Guillermo Ruffino
    Guillermo Ruffino about 5 years
    Also had Git already installed, just closed VS deleted git folder, restarted and everything was ok.
  • Rich
    Rich about 5 years
    I'm not sure which step fixed the problem, but I did uninstall the older version of git that I had and installed the latest as well as the other steps you mentioned and now it works.
  • chiwal
    chiwal about 5 years
    To get to Credential Manager just search for it in windows 10 (use the windows key). Then click Windows Credentials. Scroll down to the Generic Credential section and look for git: https://your.tfs.server. I received this error after changing my windows password.
  • Alex
    Alex almost 5 years
    Why do you think that the issue in wrong creds? It will help only in one case but you'll receive another error. Thi doesn't solve problem
  • danbord
    danbord almost 5 years
    After HOURS of struggling I finally found my solution here... Thanks a bunch! :D
  • ΩmegaMan
    ΩmegaMan over 4 years
    The location of the credentials is in the Windows Credentials section now and not Web Credentials. Otherwise the proceeding steps are the same on Windows 10.
  • Barumpus
    Barumpus over 4 years
    For me, all I needed was step 1. (VS 2017 Enterprise, already had git for windows installed.) I exited Visual Studio 2017 first, deleted that GIT folder, then reloaded VS 2017 and all was well. Removed git folder from C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsof‌​t\TeamFoundation\Tea‌​m Explorer
  • Senura Dissanayake
    Senura Dissanayake over 4 years
    Thanks. Solved my Git issue in VS 2019
  • s.n
    s.n over 3 years
    1. Remove the link as mentioned 2. RESTART Visual Studio!
  • Fadhly Permata
    Fadhly Permata over 3 years
    I have no idea why my old credentials stop working (I did not change any credentials), Thanks for saving my day.
  • SpaceUser7448
    SpaceUser7448 about 3 years
    Worked fine for me by only doing the first step, then it used the correct version of the GIT software
  • flatrick
    flatrick about 3 years
    @StingyJack I reported the issue to Microsoft together with a Procmon dump, and the supporter from Microsoft identified that it used the wrong dll. I never did find out exactly which application I had installed that had put its required version of libeay32.dll/ssleay32.dll in the system32 folder either..
  • bakalolo
    bakalolo over 2 years
    Changed to what? Can you please clarify?
  • Doug
    Doug over 2 years
    Unbelievable - I deleted the git folder here, but it worked! C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Micros‌​oft\TeamFoundation\T‌​eam Explorer\Git
  • OAM
    OAM over 2 years
    This worked for me. Thanks a lot.