带有分支子模块的Git存储库在递归克隆时出错

3pmvbmvn  于 2023-02-14  发布在  Git
关注(0)|答案(1)|浏览(177)

我有一个git仓库,里面包含了其他仓库的特定分支的子模块,我正在为Godot游戏引擎制作插件,我使用git子模块和分支作为临时的软件包系统,通过github操作将我的插件发布到仓库中它自己的发布分支,然后我可以使用发布分支作为其他插件、项目等的子模块。
然而,我在创建一个插件的子模块时遇到了一个问题,这个插件使用了另一个插件。下面是我的子模块依赖关系的布局。

FixedGodotVolatilePhysicsRollback
|-> FracturalCommons
'-> FixedGodotVolatilePhysics
   '-> FracturalCommons

当我递归地克隆存储库时,我最终得到一个错误:

git clone --recurse-submodules https://github.com/Fractural/GodotFixedVolatilePhysicsRollback.git
Cloning into 'GodotFixedVolatilePhysicsRollback'...
remote: Enumerating objects: 493, done.
remote: Counting objects: 100% (493/493), done.
remote: Compressing objects: 100% (291/291), done.
remote: Total 493 (delta 185), reused 493 (delta 185), pack-reused 0
Receiving objects: 100% (493/493), 2.24 MiB | 11.94 MiB/s, done.
Resolving deltas: 100% (185/185), done.
Submodule 'addons/FracturalCommons' (https://github.com/Fractural/FracturalCommons.git) registered for path 'addons/FracturalCommons'
Submodule 'addons/GodotFixedVolatilePhysics' (https://github.com/Fractural/GodotFixedVolatilePhysics.git) registered for path 'addons/GodotFixedVolatilePhysics'
Submodule 'addons/GodotRollbackNetcodeMono' (https://github.com/Fractural/GodotRollbackNetcodeMono.git) registered for path 'addons/GodotRollbackNetcodeMono'
Submodule 'addons/godot-rollback-netcode' (https://github.com/Fractural/GodotRollbackNetcodeMono.git) registered for path 'addons/godot-rollback-netcode'`
Cloning into 'C:/Location/GodotFixedVolatilePhysicsRollback/addons/FracturalCommons'...
remote: Enumerating objects: 1157, done.
remote: Counting objects: 100% (328/328), done.
remote: Compressing objects: 100% (225/225), done.
remote: Total 1157 (delta 150), reused 273 (delta 100), pack-reused 829
Receiving objects: 100% (1157/1157), 2.62 MiB | 8.59 MiB/s, done.
Resolving deltas: 100% (571/571), done.
Cloning into 'C:/Location/GodotFixedVolatilePhysicsRollback/addons/GodotFixedVolatilePhysics'...
remote: Enumerating objects: 1400, done.
remote: Counting objects: 100% (458/458), done.
remote: Compressing objects: 100% (285/285), done.
remote: Total 1400 (delta 275), reused 308 (delta 159), pack-reused 942
Receiving objects: 100% (1400/1400), 70.60 MiB | 15.96 MiB/s, done.
Resolving deltas: 100% (764/764), done.
Cloning into 'C:/Location/GodotFixedVolatilePhysicsRollback/addons/GodotRollbackNetcodeMono'...
remote: Enumerating objects: 187, done.
remote: Counting objects: 100% (187/187), done.
remote: Compressing objects: 100% (144/144), done.
remote: Total 187 (delta 51), reused 169 (delta 33), pack-reused 0
Receiving objects: 100% (187/187), 421.51 KiB | 5.94 MiB/s, done.
Resolving deltas: 100% (51/51), done.
Cloning into 'C:/Location/GodotFixedVolatilePhysicsRollback/addons/godot-rollback-netcode'...
remote: Enumerating objects: 187, done.
remote: Counting objects: 100% (187/187), done.
remote: Compressing objects: 100% (144/144), done.
remote: Total 187 (delta 51), reused 169 (delta 33), pack-reused 0
Receiving objects: 100% (187/187), 421.51 KiB | 7.81 MiB/s, done.
Resolving deltas: 100% (51/51), done.
Submodule path 'addons/FracturalCommons': checked out 'ba68b154508ff4239fd864ceb6c81bb899e44936'
Submodule path 'addons/GodotFixedVolatilePhysics': checked out '7293bbf098bd1613c47f0377d5d753a5611ee24b'
fatal: No url found for submodule path 'addons/GodotFixedVolatilePhysics/addons/FracturalCommons' in .gitmodules
fatal: Failed to recurse into submodule path 'addons/GodotFixedVolatilePhysics'

因为我是从release分支拉取的,所以不需要递归遍历FixedGodotVolatilePhysics的子模块,因为release分支不包含.gitmodules文件,只包含插件的文件夹。有没有办法在克隆包含子模块的仓库时避免这个错误?

euoag5mw

euoag5mw1#

我目前的解决方案是

git clone https://github.com/Fractural/GodotFixedVolatilePhysicsRollback.git
cd GodotFixedVolatilePhysicsRollback
git submodule update --init

这似乎只需要初始化仓库的直接子模块(从而避免了加载嵌套的子模块)。如果有人找到更好的解决方案,请告诉我!

相关问题