GitHub Commit Error: Permission denied fatal: Unable to process path ~/App_Data/aspnet-MyProject.mdf
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
Right click the Local Db or the database to which the file is associated and
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.