Git 添加 . ASP.NET MVC 应用程序中出现错误

问题描述 投票:0回答:1

我正在开发一个 ASP.NET MVC 应用程序,但在部署它时遇到了困难。当我发出命令

git add .
时,出现以下错误:

git : error: open(".vs/DonationSite/FileContentIndex/56f14db3-4306-4df1-bad7-f487ea83802a.vsidx"): Permission denied
At line:1 character:1
+ git add .
+ ~~~~~~~~~
    + CategoryInfo          : NotSpecified: (error: open(".v...rmission denied:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

error: unable to index file 
'.vs/DonationSite/FileContentIndex/56f14db3-4306-4df1-bad7-f487ea83802a.vsidx'
fatal: adding files failed

我已经尝试将

.gitignore
移动到根文件夹,但没有成功

asp.net-mvc git visual-studio
1个回答
0
投票

如果您尝试从以下文件夹推送代码

enter image description here

你会遇到这个问题。

error: open(".vs/GitPush/FileContentIndex/c1f9f8f4-a85c-479e-a361-e9906066bc97.vsidx"): Permission denied
error: unable to index file '.vs/GitPush/FileContentIndex/c1f9f8f4-a85c-479e-a361-e9906066bc97.vsidx'
fatal: adding files failed
  • 打开
    .vs
    =>
    GitPush
    =>
    FileContentIndex
    ,您将找到扩展名为
    .vsidx
    的文件。

enter image description here

  • 关闭在 Visual Studio 中打开的应用程序。
  • 删除该文件。

enter image description here

  • 现在运行命令

    git add .
    enter image description here

  • 运行以下命令来完成任务。

git init
git add README.md
git commit -m "Commit after add"
git branch -M main
git remote add origin https://github.com/HarshithaVeeramalla/GitHubRepo.git
git push -u origin main

enter image description here

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.