【问题标题】:'Unable to create file ... Operation not permitted' when cloning a repo from GitHub从 GitHub 克隆存储库时“无法创建文件...不允许操作”
【发布时间】:2021-09-16 10:44:27
【问题描述】:

正如标题所说,我正在尝试在 VSCode 中克隆我的一个 GitHub 存储库。我收到以下错误:

fatal: Unable to create temporary file '/Users/user/Documents/Projects/MyGamesList/MyGamesList/.git/objects/pack/tmp_pack_XXXXXX': Operation not permitted

我在删除仓库的本地文件后克隆了这个仓库,因为我在尝试使用 npm start 时遇到了 EPERM Operation not permitted

我使用的是 macOS Big Sur 11.4。我已尝试更改我的文档文件夹的权限并更新 NPM。

【问题讨论】:

    标签: macos github npm visual-studio-code file-permissions


    【解决方案1】:

    一般来说,您不希望将 Git 存储库放在 macOS Documents 文件夹中。您可能会看到 macOS 将对该文件夹的访问限制为基于 permissions that are outside the normal Unix framework 的某些程序。因此,在这些情况下,您经常可以看到EPERM

    虽然可以授予 Git 和 npm 访问权限以修改 Documents 中的数据,因为 Git 仍然有用 Perl 和 shell 编写的命令,但您还需要授予对每个 Unix 命令行工具的访问权限,这很不方便。

    此外,Documents 文件夹有时会通过 iCloud 同步,您应避免将 Git 存储库存储在由 iCloud 或类似的基于文件的同步服务同步的目录中,因为这可能会导致存储库损坏。

    如果您将Projects 文件夹从Documents 移到您的主目录中,则一切正常。

    【讨论】:

      猜你喜欢
      • 2016-10-09
      • 1970-01-01
      • 2014-05-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-31
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多