git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 0/3] config: allow disabling config includes

From
Jeff King <peff@peff.net>
Date
Jun 8, 2026, 22:51 UTC
Message-ID
<20260608225149.GB340696@coredump.intra.peff.net>
In-Reply-To
<pull.2139.git.1780927027.gitgitgadget@gmail.com>
On Mon, Jun 08, 2026 at 01:57:03PM +0000, Derrick Stolee via GitGitGadget wrote:
Show 11 quoted lines
> This series introduces a new way to ignore config include directives via two
> mechanisms:
> 
>  * GIT_CONFIG_INCLUDES=0 in the environment.
>  * git --no-includes ... in the command line.
> 
> My motivation is from a tricky situation where users want to do the risky
> thing and include a repo-tracked file for sharing aliases and other
> recommended config. They are then struggling in a later build step that is
> running Git commands (under a tool we don't control and can't change) that
> then cause filesystem accesses outside of the build system's sandbox.

I'm not opposed to global control of includes, but this is just one way in which config can escape the sandbox. They can always point to files (e.g., core.attributesFile) or even commands that totally leave the sandbox (e.g., ext diff or textconv commands). Fundamentally git config is equivalent to arbitrary code execution, so pointing an include at a repo-tracked file carries the risk of confusion both malicious and accidental.

So I dunno. From the described motivation, this feels like a band-aid that fixes only one narrow instance of a greater problem.

The notion of enabling/disabling includes per-command is itself a flexible building block. So it's possible that it has other uses in general. But it's also a fairly broad hammer that covers more than your use case. If you're planning to use "git --no-includes" in some script, then it breaks the config of anybody who uses includes in their user-level ~/.gitconfig file.

So you may need some more directed limiting.
> One thing I do worry about is whether or not this would cause a significant
> break in behavior, or if this is a relatively safe thing to allow.
Yeah. Consider something like:
  $ cat ~/.gitconfig
  [user]
  name = My Name
  email = me@personal.example.com
  [includeIf "gitdir:/path/to/work/stuff"]
  path = .gitconfig-work
  $ cat ~/.gitconfig-work
  [user]
  email = me@work.example.com

Using "git --no-include" will silently use the wrong user.email value. That's OK if the user is asking for it, but if you are planning to sprinkle "--no-include" inside scripts, that's likely to cause confusion.

-Peff
Previous: Derrick Stolee via GitGitGadgetNext: Derrick Stolee
Message 8 of 14 in “config: allow disabling config includes”
  1. 0/3 config: allow disabling config includesDerrick Stolee via GitGitGadget, Jun 8, 2026
  2. 1/3 git-config.adoc: fix paragraph breakDerrick Stolee via GitGitGadget, Jun 8, 2026
  3. 2/3 config: add GIT_CONFIG_INCLUDESDerrick Stolee via GitGitGadget, Jun 8, 2026
  4. Patrick SteinhardtJun 8, 2026
  5. Derrick StoleeJun 8, 2026
  6. Patrick SteinhardtJun 9, 2026
  7. 3/3 git: add --no-includes top-level optionDerrick Stolee via GitGitGadget, Jun 8, 2026
  8. Jeff KingJun 8, 2026
  9. Derrick StoleeJun 9, 2026
  10. Jeff KingJun 11, 2026
  11. Derrick StoleeJun 11, 2026
  12. Junio C HamanoJun 17, 2026
  13. Derrick StoleeJun 17, 2026
  14. Junio C HamanoJun 17, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.