'Unable to create file ... Operation not permitted' 从 GitHub 克隆一个 repo 时
'Unable to create file ... Operation not permitted' when cloning a repo from GitHub
正如标题所说,我正在尝试在 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。
一般来说,您不希望将 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
移到您的主目录中,一切都会正常进行。
正如标题所说,我正在尝试在 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。
一般来说,您不希望将 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
移到您的主目录中,一切都会正常进行。