GitHub Commit Error: Permission denied fatal: Unable to process path ~/App_Data/aspnet-MyProject.mdf

半腔热情 提交于 2019-12-01 16:55:43

You shouldn't be committing mdf files to git - they are data files for your database. git is likely complaining because the file is in use and it needs read access to be able to send the data to the repository. The simplest solution is to remove it from git with git rm. For example, at the command line:

git rm MyProject/App_Data/aspnet- MyProject-20171110110346.mdf

If you still want to add your mdf files to git. I was having some trouble with this too, so what I found out is:

If you're using Server Explorer from Visual Studio, just right click on your Connection name in the Server Explorer window and click on Close Connection.

May be this will help someone in the future. The problem is that you still have the file connected to your Local DB in the Server explorer and the file has handles in use which blocks the commit to occur.

What I actually did was

  1. Right click the Local Db or the database to which the file is associated and

  2. choose Detach option so it can release any handles from the .mdf or .ldf files.

PS: you can attach the database anytime you wish to except during the commit timeframe.

Once the database is detached, the commit works without any problem. Try this and it works most of the time.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!