Git clone --recurse-submodules 在 MacO 上抛出错误:不允许传输类型“文件”

exc*_*ion 13 git

我在网络驱动器上有一个 git 远程存储库,尝试使用以下命令将此存储库克隆到 Mac 计算机:

\n
git clone --rescurse-submodules /Volumes/path/to/repository.\n
Run Code Online (Sandbox Code Playgroud)\n

主存储库克隆得很好,但对于所有子模块,我收到如下消息:

\n
Transmission type 'file' not allowed\n
Run Code Online (Sandbox Code Playgroud)\n

(德语原文是\xc3\x9cbertragungsart 'file' nicht erlaubt)。

\n

子模块文件夹保持为空。

\n

子模块的路径看起来不错,所以我不认为这是与路径相关的错误。\nWindows 计算机上的相同操作运行良好。

\n

vin*_*zee 17

您的错误消息的翻译是:

transport 'file' not allowed
Run Code Online (Sandbox Code Playgroud)

要解决这个问题,请运行:

transport 'file' not allowed
Run Code Online (Sandbox Code Playgroud)

或者

git -c protocol.file.allow=always clone --recurse-submodules /Volumes/path/to/repository
Run Code Online (Sandbox Code Playgroud)

请参阅https://git-scm.com/docs/git-config#Documentation/git-config.txt-protocolallow


感谢grg的评论phd的评论

  • 请注意,这也修复了子模块添加的相同问题: `git -c protocol.file.allow=always submodule add ../dir` (3认同)