Git 2.48 (Q1 2025), batch 5 documents another possible cause for this error message: a "git fetch from
"(man) the superproject going down to a submodule used a wrong remote when the default remote names are set differently between them. It comes with a fatal: transport 'file' not allowed
.
See commit 0c1a998 (09 Oct 2024) by Daniel Black (grooverdan
).
(Merged by Taylor Blau -- ttaylorr
-- in commit 6cbcc68, 25 Oct 2024)
submodule
: correct remote name with fetchSigned-off-by: Daniel Black
The code fetches the submodules remote based on the superproject remote name instead of the submodule remote name (see this thread.
Instead of grabbing the default remote of the superproject repository, ask the default remote of the submodule we are going to run '
git fetch
'(man) in.
The reproducible case was:
It happens that my default remote isn't "
origin
" (long story), it's "github
", but in the submodule it's of course "origin
", there's no "github
" remote there.
As a result,git submodule update
runs the commandgit fetch github ${commit_hash}
in the submodule, and that's interpreted as '
file
' transport.To repeat this, you need a repository where the default remote isn't "
origin
", and a submodule where the commit cannot be fetched by simplygit fetch
and needs a direct fetch.