Hi again, So I made a repro - it even fails locally (you have to explicitly allow submodules to work with "file" transport). Try the following: git config --global protocol.file.allow always mkdir bottom cd bottom git init echo hello > bottom.txt git add . git commit -m Bottom cd .. mkdir middle cd middle git init echo hello > middle.txt git add . git commit -m Middle git submodule add ../bottom bottom git commit -m MiddleSub cd .. mkdir top cd top git init echo hello > top.txt git add . git commit -m Top git submodule add ../middle middle git commit -m TopSub cd .. git clone --recurse-submodules top clone_ok git config --global submodule.recurse true git config --global submodule.active . git clone --recurse-submodules top clone_err Note: If those submodule settings are set initially, then even creating the top repository fails. Regards, -Jeppe On Tue, Jun 25, 2024 at 3:54 PM Jeppe Øland <joland@xxxxxxxxx> wrote: > > Hi there, > > I'm seeing a strange thing with multi-level submodules. > Not sure what's going on, but it feels like a bug. > (I'm doing this on git "2.45.2.windows.1"). > > For a while, I've been globally setting the recursive and active config options: > git config --global submodule.recurse true > git config --global submodule.active . > This has the benefit that I don't need to "git submodule init" new > modules since everything is active. > > The weirdness happens when there are submodules within a submodule. > > I can reproduce it by just creating 3 git repositories (I have only > tried with GH hosted repos, maybe its different if done locally). > Each repo has a directory within it, and that directory is a submodule > of the next one. > top -> middle -> bottom > > Now, if I don't set the global config above, I can: > "git clone --recurse-submodules <PATH>" to get everything. > Or: > "git clone <PATH>", "cd", "git submodule init", "git pull" etc. to > again get everything. > > But if I set the global options, I can do: > "git clone <PATH>" to clone the top level. > "cd top" to go in there. > "git pull" to update everything, including submodules. > But while cloning "middle", it gives me an error: > fatal: not a git repository: ../../.git/modules/middle/modules/bottom > > Something is getting confused and thinks there are worktrees involved: > ".git/modules/middle/config" has "worktree" line in the [core] > section (this appears to be normal). > ".git/modules/middle/modules/bottom/config" is not a repository, > but just a "[core] worktree" section (definitely not normal). > > This all works fine if there is only one level of submodules (top->middle). > > Any ideas? > > Regards, > -Jeppe