Git拒绝在其他子模块的目录中创建/使用目录

4
我试着使用 git submodule update --recursive --remote --init 来递归更新 git 子模块。模块结构如下:

  • A
    • B
      • C/master
      • C/backend
      • C/frontend

C 中使用的所有分支都是孤立的,代码完全分离...

所有仓库都是私有的,但我是所有者。

这是每次收到的消息。(尝试同步、使用 git://、先不递归更新等方法)

Failed to clone 'C/master'. Retry scheduled

error: 子模块 git 目录 'F:/Docs/A/.git/modules/B/modules/C/backend' 在 'F:/Docs/A/.git/modules/B/modules/C' 目录内

fatal: 拒绝在另一个子模块的 git 目录中创建/使用 'F:/Docs/A/.git/modules/B/modules/C/backend'

有什么想法可以解决这个问题吗?

1个回答

1

由于仓库名称和路径名不同,git add 使用的是路径名而不是目录名来命名子模块,在 repo B 中更改 .gitmodules 中子模块的名称可以解决此问题...

之前:

[submodule "Folder/master"]
    path = Folder/master
    url = https://github.com/tomkys144/C
    branch = master
[submodule "Folder/backend"]
    path = "Folder/backend
    url = https://github.com/tomkys144/C
    branch = backend
[submodule "Folder/frontend"]
    path = Folder/frontend
    url = https://github.com/tomkys144/C
    branch = frontend

固定:
[submodule "C/master"]
    path = Folder/master
    url = https://github.com/tomkys144/C
    branch = master
[submodule "C/backend"]
    path = "Folder/backend
    url = https://github.com/tomkys144/C
    branch = backend
[submodule "C/frontend"]
    path = Folder/frontend
    url = https://github.com/tomkys144/C
    branch = frontend

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接