首页 > 解决方案 > 使用 `git add` 将文件添加到索引时出现“权限被拒绝”

问题描述

我在使用 git 时遇到问题。我在 Visual Studio 代码中有 5000 个待定更改需要提交。这些是未上演的,但我无法上演它们以提交。我的 .git 文件夹存在于 Windows 中。我的所有项目都在我的桌面上,位于不同的文件夹中,但我只是将它们全部移动到一个名为 Projects 的文件夹中,该文件夹位于我的桌面上。我试过 cd 进入这个文件夹,但没有运气。当我输入时git add -A,我得到了这个

warning: could not open directory 'AppData/Local/Application Data/': Permission denied
warning: could not open directory 'AppData/Local/ElevatedDiagnostics/': Permission denied
warning: could not open directory 'AppData/Local/History/': Permission denied
warning: could not open directory 'AppData/Local/Microsoft/Windows/INetCache/Content.IE5/': Permission denied
warning: could not open directory 'AppData/Local/Microsoft/Windows/Temporary Internet Files/': Permission denied
warning: could not open directory 'AppData/Local/Temporary Internet Files/': Permission denied

抱歉,如果我对我在寻找什么有点不清楚,我是 git 和 github 的新手。我只想提交 5000 个更改,并继续跟踪要跟踪的文件。谢谢你。

附上许可被拒绝的图片:

附上权限被拒绝的图片

标签: git

解决方案


看来您已经在用户文件夹中创建了 git 存储库。此文件夹包含许多其他进程正在使用的文件。因此,您将无法添加它们。

我认为您在错误的位置创建了存储库。


推荐阅读