jdx/mise · error

too many inherited Git configuration entries

Error message

too many inherited Git configuration entries

What it means

When spawning a git child process, the session inherits the environment and forwards GIT_CONFIG_COUNT-based config entries. Because huge GIT_CONFIG_COUNT values can make git read arbitrary numbers of config files (a known injection/DoS vector), the session caps it at 1000 entries and fails with "too many inherited Git configuration entries" if the inherited environment exceeds that.

Source

Thrown at src/github_relay.rs:846

            child.args(&command[1..]);
            child
        };
        let executable = std::env::current_exe()?;
        let mut paths = vec![
            executable
                .parent()
                .ok_or_else(|| eyre::eyre!("missing mise executable directory"))?
                .to_path_buf(),
        ];
        paths.extend(std::env::split_paths(
            &std::env::var_os("PATH").unwrap_or_default(),
        ));
        child.env("PATH", std::env::join_paths(paths)?);
        let count: usize = std::env::var("GIT_CONFIG_COUNT")
            .unwrap_or_else(|_| "0".into())
            .parse()?;
        if count > 1000 {
            bail!("too many inherited Git configuration entries");
        }
        let base = format!("http://{address}/{capability}/git/");
        for (index, source) in [
            "https://github.com/",
            "git@github.com:",
            "ssh://git@github.com/",
        ]
        .iter()
        .enumerate()
        {
            child.env(
                format!("GIT_CONFIG_KEY_{}", count + index),
                format!("url.{base}.insteadOf"),
            );
            child.env(format!("GIT_CONFIG_VALUE_{}", count + index), source);
        }
        child
            .env("GIT_CONFIG_COUNT", (count + 3).to_string())

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Clear or lower GIT_CONFIG_COUNT before starting the session (unset it or set it to the actual number of GIT_CONFIG_KEY_N/GIT_CONFIG_VALUE_N pairs).
  2. Audit the parent environment/CI wrapper that is setting hundreds/thousands of git config entries.
  3. Pass needed git config via a config file or -c arguments on the git command instead of the counted-environment mechanism.

Example fix

// before
export GIT_CONFIG_COUNT=2000  # set by an accumulating wrapper
// after
unset GIT_CONFIG_COUNT GIT_CONFIG_KEY_0 GIT_CONFIG_VALUE_0  # or set to real pair count
Defensive patterns

Strategy: validation

Validate before calling

let count: usize = std::env::var("GIT_CONFIG_COUNT")
    .unwrap_or_else(|_| "0".into())
    .parse()
    .unwrap_or(0);
if count > 1000 {
    // unset GIT_CONFIG_COUNT and its KEY/VALUE pairs before launching
}

Prevention

When it happens

Trigger: Running the relay session in an environment where GIT_CONFIG_COUNT is set above 1000 — e.g. inherited from a parent CI job, a malicious/buggy wrapper script, or tooling that appends config entries without bound.

Common situations: Nested tool invocations (mise inside mise, CI inside CI) where each layer appends git config entries; a poisoned environment from an untrusted repo's config hooks; scripts that increment GIT_CONFIG_COUNT per setting over a long session.

Understand the failure class

Background: "is not a valid" / "Invalid ... value" environment variable errors: how libraries validate env vars and what to do when they reject yours — this error's family across 48 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/a30231a640827aa2. Report an issue: GitHub.