GitHub提交错误:权限被拒绝致命:无法处理路径〜/ App_Data / aspnet-MyProject.mdf [英] GitHub Commit Error: Permission denied fatal: Unable to process path ~/App_Data/aspnet-MyProject.mdf

查看:444
本文介绍了GitHub提交错误:权限被拒绝致命:无法处理路径〜/ 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.

我正在开发Code-First Migrations。在我以前的成功提交之后,我在Visual Studio的包管理器控制台上执行了以下命令:

I am working on Code-First Migrations. After my previous successful commit, I performed the following commands on 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 commands above added .mdf file to App_Data folder of the project.

推荐答案

您不应该将 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆