Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
852 views
in Technique[技术] by (71.8m points)

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

I am attempting to commit an update to my ASP.Net MVC project using GitHub integration in Microsoft Visual Studio 2017.

I am working on Code-First Migrations. After my previous successful commit, I performed the following commands on the Package Manager Console in Visual Studio:

PM> Enable-Migrations -ContextType ApplicationDbContext
PM> Add-Migration AccountNumberChanges
PM> Update-Database -Verbose

Once this was done, I tried perform a commit, but I was getting the following error:

Git failed with a fatal error.
error: open("MyProject/App_Data/aspnet-MyProject-
20171110110346.mdf"): Permission denied
fatal: Unable to process path MyProject/App_Data/aspnet-
MyProject-20171110110346.mdf

The above commands have added the .mdf file to the project's App_Data folder.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...