Gemini CLI env sanitization could break every git call; PR restores GIT_CONFIG consistency

Shivansh1980 · ghdev · 2026-08-21

A PR against google-gemini/gemini-cli fixes sanitizeEnvironment() emitting a GITCONFIG environment that git refuses to parse — git aborts on a malformed directive rather than skipping it, so every git invocation through the sanitized environment fails.

Root cause: secret-redaction checks run before the GITCONFIG exemption (locked in by security tests). When a GITCONFIGVALUEn carrying a credential is dropped, its GITCONFIGKEYn and the declared GITCONFIGCOUNT survive, leaving a fatal gap. Realistic triggers: url.<base>.insteadOf rewrites with embedded credentials and http.extraheader bearer tokens; also fires under strict CI sanitization (GITHUBSHA set).

Second path: parseInt on an inherited non-numeric GITCONFIGCOUNT yields NaN, so overrides land on GITCONFIGKEYNaN. Fix touches environmentSanitization.ts and friends.

Original post →

More from coding & agent

coding & agent channel →