Re: [BUG] protocol.file.allow=always not honored when --local
- From
Jeff King <peff@peff.net>
- Date
- Oct 17, 2025, 07:15 UTC
- Message-ID
- <20251017071532.GA4073661@coredump.intra.peff.net>
- In-Reply-To
- <176066758616.6.12811000416591629223.957743298@passmail.net>
On Fri, Oct 17, 2025 at 02:19:38AM +0000, fence.borrowing375@passmail.net wrote:
Show 13 quoted lines
> Created an empty directory, then initialized git: > `mkdir ~/test && cd ~/test && git init` > > Ensured file:// transport protocol is default/unset value (file:// is > disabled by default): > `git config --list | grep protocol` > # no output > > Enabled file:// transport for local repository: > `git config --local protocol.file.allow always` > > Then, attempted to add a git submodule: > `git submodule add /path/to/module/.git`
I don't think this will work as you expect, because of the use of "git config --local". When we run git-clone under the hood to clone the new submodule, it is a new repository, and does not look at the config of the containing repository at all[1].
As you noted, setting it in the user-level "--global" config file would work. You can also override the config via the environment like:
git -c protocol.file.allow=always submodule add ...
though note that anybody cloning will need to do the same thing (and of course have the submodule available at the exact same local path!).
-Peff
[1] There have been discussions in the past on whether submodules should
receive some config from the superproject repository. But there are
a lot of complications, as it is the right thing for some config
keys but not for some others. I doubt we will change the behavior
anytime soon.