git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: fence.borrowing375@passmail.net
To: git@vger.kernel.org
Subject: [BUG] protocol.file.allow=always not honored when --local
Date: Fri, 17 Oct 2025 02:19:38 +0000	[thread overview]
Message-ID: <176066758616.6.12811000416591629223.957743298@passmail.net> (raw)

Thank you for filling out a Git bug report!
Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your
issue)

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`


What did you expect to happen? (Expected behavior)

Successful clone:
```
Cloning into '/home/username/test/module'...
done.
```


What happened instead? (Actual behavior)

Failed clone:
```
Cloning into '/home/username/test/module'...
fatal: transport 'file' not allowed
fatal: clone of '/path/to/module/.git' into submodule path
'/home/head/data/infra/src/test/git' failed
```


What's different between what you expected and what actually happened?

The default behavior of disabling the file:// protocol should have been
overridden by the config, but was not. In contrast, it gets enabled as
expected when setting the config user-wide:
`git config --global protocol.file.allow always`

I do not want to enable file:// by default due to security
implications. I only want to enable it for specific repositories but
cannot do so as this setting is not honored when --local.


Anything else you want to add:

A similar error message shows when attempting to update an existing
submodule with only the --local config set.

This bug is also present in git version 2.39.5.


[System Info]
git version:
git version 2.51.1.472.g4253630c6f
cpu: x86_64
built from commit: 4253630c6f07a4bdcc9aa62a50e26a4d466219d1
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
rust: disabled
libcurl: 7.88.1
OpenSSL: OpenSSL 3.0.17 1 Jul 2025
zlib: 1.2.13
SHA-1: SHA1_DC
SHA-256: SHA256_BLK
default-ref-format: files
default-hash: sha1
compiler info: gnuc: 12.2
libc info: glibc: 2.36
$SHELL (typically, interactive shell): /bin/bash




             reply	other threads:[~2025-10-17  2:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-17  2:19 fence.borrowing375 [this message]
2025-10-17  7:15 ` [BUG] protocol.file.allow=always not honored when --local Jeff King
2025-10-21 14:41   ` fence.borrowing375

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=176066758616.6.12811000416591629223.957743298@passmail.net \
    --to=fence.borrowing375@passmail.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).