An error was raised by libgit2. Category = Os (Err

2019-02-17 02:49发布

I have run into this several times now:

 An error was raised by libgit2. Category = Os (Error). 

Which sometimes causes this or similar error while i am writing code:

Failed to open '.../App_Data/....mdf': 
The process cannot access the file because it is being used by another process.

When this happens i can't code without restarting my Visaul Studio 2012.

I think it's being caused by Source Control - Git as i don't remember having this problem before i installed the Git extension for Visual Studio and Team Foundation.

Has anyone else run into this and how did they solve it?

3条回答
▲ chillily
2楼-- · 2019-02-17 03:03

I just ran into this today with a new Visual Studio project. The project was using the autogenerated .gitignore which had the following entries which I thought should have covered the .mdf file just fine:

# SQL Server files
App_Data/*.mdf
App_Data/*.ldf

However I still received:

An error was raised by libgit2. Category = Os (Error). 
Failed to open '.../App_Data/....mdf': 
The process cannot access the file because it is being used by another process.

So I edited the .gitignore, preceding each entry with an asterisk-slash, like so:

# SQL Server files
*/App_Data/*.mdf
*/App_Data/*.ldf

And I was able to continue business as usual.

查看更多
太酷不给撩
3楼-- · 2019-02-17 03:04

I would want to add it is maybe just as simple as => Close your database connexion :)

查看更多
Viruses.
4楼-- · 2019-02-17 03:24

I had the same error. IIS express was running in the system tray. When I killed IIS Express everything committed as expected.

查看更多
登录 后发表回答