GitHub 提交错误:权限被拒绝致命:无法处理路径 ~/App_Data/aspnet-MyProject.mdf [英] GitHub Commit Error: Permission denied fatal: Unable to process path ~/App_Data/aspnet-MyProject.mdf
问题描述
我正在尝试使用 Microsoft Visual Studio 2017 中的 GitHub 集成提交对我的 ASP.Net MVC 项目的更新.
I am attempting to commit an update to my ASP.Net MVC project using GitHub integration in Microsoft Visual Studio 2017.
我正在研究代码优先迁移.在上一次成功提交后,我在 Visual Studio 的包管理器控制台上执行了以下命令:
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
以上命令已将 .mdf 文件添加到项目的 App_Data 文件夹中.
The above commands have added the .mdf file to the project's App_Data folder.
推荐答案
您不应该将 mdf
文件提交到 git - 它们是您数据库的数据文件.git
可能会抱怨,因为文件正在使用中,它需要读取权限才能将数据发送到存储库.最简单的解决方案是使用 git rm
从 git 中删除它.例如,在命令行:
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
这篇关于GitHub 提交错误:权限被拒绝致命:无法处理路径 ~/App_Data/aspnet-MyProject.mdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!