VisualStudio: An error was raised by libgit2. Cate

2019-03-17 04:56发布

问题:

I'm using TFS with Git, installed Visual Studio Tools for Git.

I'm trying to pull all commits (5 in total) from TFS, but I get this error below:

An error occurred. Detailed message: An error was raised by libgit2. 
Category = Checkout (MergeConflict).
2 conflicts prevent checkout

How do I resolve this?

回答1:

Sadly, the Visual Studio plugin for Git doesn't display the error messages you need to troubleshoot this problem. (I hope they plan that feature for a later release.)

Try pulling the latest commits using Git Bash or using TortoiseGit. Either of those tools should let you know where your conflicts are.



回答2:

To see the error you should run git command line You can find it at Team Emplorer -> Unsynched commits -> Actions -> Open in Command Prompt

Then you should use git pull command

Be careful with credential if you are using visualstudio.com, in this case you must have an alternative login and password for connect to git from command prompt.



回答3:

For resolving the issue follow below steps:-

1)Close visual studio.
2)Now Open visual studio without opening any solution..
3)Open team viewer and then go to git home->changes..
4)Then click on commit..
5)Now you will get the unresolved conflicts..
6)Resolve the conflicts and commit..

Problem Resolved :).
Cheers



回答4:

This error often occurs when:

  • You have a proxy on your network:

    See some solutions on configuring your git proxy settings here.

  • or... The git url you are trying to connect to is over 256 characters



回答5:

Visual Studio Tool for Git didn't supported the remote repositories using the SSH protocol, only HTTP and HTTPS were supported but now it supports SSH as well.

See the url on how to resolve this- https://github.com/libgit2/libgit2sharp/issues/255



回答6:

Got a hint from @Blowsie, in my case, turned off fiddler capturing or similar packet capturing tool.



回答7:

I was able to resolve this by doing a pull from Team Explorer in VS 2013 without having any solution open. Just do this one time.

This worked, and since then I haven't seen libgit error for any other solution as well.

This is tested for VS 2012 as well.



回答8:

This happens when your incoming fetch conflicts with your uncommitted files. first try to commit the changes you did or undo them. And try to push again. if it doesn't work, the conflict file should be in the Untracked files. Try to find it and delete it. this should work.



回答9:

Incoming and Outgoing commits in different branches. You must to marge them before sync. I do it in Source Tree, there you can clearly see branching.



回答10:

First you need to commit local pending changes in local branch.then pull from master branch. resolved conflicts and push the local changes on master branch