{"record":{"id":"a30231a640827aa2","repo":"jdx/mise","slug":"too-many-inherited-git-configuration-entries","errorCode":null,"errorMessage":"too many inherited Git configuration entries","messagePattern":"too many inherited Git configuration entries","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/github_relay.rs","lineNumber":856,"sourceCode":"            child.args(&command[1..]);\n            child\n        };\n        let executable = std::env::current_exe()?;\n        let mut paths = vec![\n            executable\n                .parent()\n                .ok_or_else(|| eyre::eyre!(\"missing mise executable directory\"))?\n                .to_path_buf(),\n        ];\n        paths.extend(std::env::split_paths(\n            &std::env::var_os(\"PATH\").unwrap_or_default(),\n        ));\n        child.env(\"PATH\", std::env::join_paths(paths)?);\n        let count: usize = std::env::var(\"GIT_CONFIG_COUNT\")\n            .unwrap_or_else(|_| \"0\".into())\n            .parse()?;\n        if count > 1000 {\n            bail!(\"too many inherited Git configuration entries\");\n        }\n        let base = format!(\"http://{address}/{capability}/git/\");\n        for (index, source) in [\n            \"https://github.com/\",\n            \"git@github.com:\",\n            \"ssh://git@github.com/\",\n        ]\n        .iter()\n        .enumerate()\n        {\n            child.env(\n                format!(\"GIT_CONFIG_KEY_{}\", count + index),\n                format!(\"url.{base}.insteadOf\"),\n            );\n            child.env(format!(\"GIT_CONFIG_VALUE_{}\", count + index), source);\n        }\n        child\n            .env(\"GIT_CONFIG_COUNT\", (count + 3).to_string())","sourceCodeStart":838,"sourceCodeEnd":874,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/github_relay.rs#L838-L874","documentation":"When starting the relay's git session, the relay reads the inherited `GIT_CONFIG_COUNT` environment variable and refuses to proceed if it exceeds 1000, because it must append its own per-index `-c` style config entries and an unbounded inherited count risks breakage and confusion. `parse()` also makes a non-numeric GIT_CONFIG_COUNT an error path.","triggerScenarios":"GIT_CONFIG_COUNT is set to a value greater than 1000 in the parent environment when the relay git session spawns; or GIT_CONFIG_COUNT contains a non-numeric string (parse error surfaces instead of this message).","commonSituations":"Deeply nested tool/shell wrappers (direnv, mise hooks, CI matrix scripts) each incrementing GIT_CONFIG_COUNT until it explodes; a leftover junk GIT_CONFIG_COUNT exported in shell rc files; a script that sets it to a non-number causing the sibling parse error.","solutions":["Unset or lower GIT_CONFIG_COUNT in your shell (`unset GIT_CONFIG_COUNT`) before running the relay/git command.","Find what keeps incrementing it (nested direnv/mise hooks, wrapper scripts) and stop stacking configs at each layer.","Consolidate git config into ~/.gitconfig or includeIf files instead of passing hundreds of -c entries via GIT_CONFIG_COUNT.","If it is non-numeric, fix the value to a plain integer to avoid the underlying parse failure."],"exampleFix":"# before (in .zshrc)\nexport GIT_CONFIG_COUNT=$((GIT_CONFIG_COUNT + 1))\n# after\nunset GIT_CONFIG_COUNT  # or only set it inside the specific script that needs it","handlingStrategy":"validation","validationCode":"const MAX_GIT_CONFIG_COUNT: usize = 1000;\nlet count: usize = std::env::var(\"GIT_CONFIG_COUNT\").unwrap_or_default().parse().unwrap_or(0);\nassert!(count <= MAX_GIT_CONFIG_COUNT, \"GIT_CONFIG_COUNT={} too high; unset it before running\", count);","typeGuard":"fn git_config_count_ok() -> bool {\n    std::env::var(\"GIT_CONFIG_COUNT\")\n        .ok()\n        .and_then(|v| v.parse::<usize>().ok())\n        .map_or(true, |c| c <= 1000)\n}","tryCatchPattern":null,"preventionTips":["Don't export GIT_CONFIG_COUNT globally in shell rc files","Consolidate git settings into gitconfig files instead of stacked -c entries","Avoid wrapper layers that increment GIT_CONFIG_COUNT on every shell spawn"],"tags":["git","environment","config","limit"],"backgroundTag":"invalid-env-var-value","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}