Visual Studio can't push commits to Github workaround

foreword

When Visual Studio fails to push changes, uninstall all Git in the system and the Git tool of Visual Studio and reinstall it

Overview of the previous situation

Today, because I want to try to use RabbitMQ, I plan to do some small demos locally for testing, and use Github for code management, and then re-build the project on SVN after the test is available. Change the source code management engine to Git in Visual Studio, clone the existing code base, add projects and codes, and submit. The error reported in the output is

failed with a fatal error.fatal: revert failed

solution process

After searching the garden by mistake, I learned that the SSH Key may be lost. However, it is said that after copying the SSH Key to the git-core folder, it still cannot be pushed using VS.

According to the StackOverflow link in the above post, I found that there is a second solution. After executing the second step in Vote, re-push it in Visual Studio and successfully sync it to Github.

The solution is posted below. If you are interested, you can go to the link at the bottom. First, use the method of replacing the SSH Key in the link. If it cannot be solved, then use the solution I listed below.

Solution

  1. Go to the installation directory of VS, delete \Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\the Gitfolder
  2. Go to the control panel program to Gituninstall all versions (TortoiseGit does not need to be deleted, just delete Git)
  3. Open the VS 2017 installer in the start menu, make modifications, and remove the checkboxes of "Git For Windows" and "Github Extension"
  4. Reinstall Git For Windows at the git website
  5. Open the VS 2017 installer and reinstall "Git For Windows"
  6. Now you can open VS to push with Team Explorer, enjoy

Related Links:

http://www.cnblogs.com/yunfeifei/p/6686065.html
https://stackoverflow.com/questions/42667928/vs-2017-git-failed-with-a-fatal-error/42917487

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325900721&siteId=291194637