Fix "fatal: unable to access 'NUL'" in Gemini CLI on Windows
Gemini CLI on Windows failing with fatal: unable to access 'NUL' is a Git for Windows 2.56.0 regression. Update Git to 2.56.0.2 or later.
fatal: unable to access 'NUL': Invalid argumentIf Gemini CLI on Windows fails with this the moment it runs git status, git log, or git diff, the cause is a Git for Windows 2.56.0 regression, not Gemini CLI, and updating to 2.56.0.2 or later fixes it. Gemini CLI sets GIT_CONFIG_GLOBAL=NUL when its shell tool runs git, to skip your user-wide config, and that value broke in 2.56.0.
[1] Check your Git version in PowerShell or Command Prompt.
$ git --versiongit version 2.56.0.windows.12.56.0.windows.1 means you are in this case. Git for Windows official issue #6449 tested both versions on the same machine and found 2.55.0.windows.5 works while 2.56.0.windows.1 breaks. The bug-fix section of the 2.56.0.2 release notes says suppressing the user-wide config via GIT_CONFIG_GLOBAL=NUL was broken in v2.56.0 and has been fixed, and attributes it to the MINGW64 → UCRT64 migration.
[2] Update Git for Windows to 2.56.0.2 or later, using the method that matches how you installed it.
| Installed with | Update |
|---|---|
| Official installer | git update-git-for-windows, or a new installer from the official site |
| winget | winget upgrade --id Git.Git |
| Scoop | scoop update git |
$ git update-git-for-windowsAfter updating, close every open terminal and Gemini CLI, then open them again; processes already running may keep the old git.exe path. Run git --version again and confirm 2.56.0.windows.2 or later.
[3] Test again inside Gemini CLI. Have the shell tool run git status; output without the error means you are done. In Gemini CLI official issue #29614, several users confirmed the update to 2.56.0.2 fixed it, and the issue was closed without a code change on the Gemini CLI side.
[4] If you cannot update right now, the issue also mentions rolling back to the 2.55 line (a comment suggested 2.55.5). But 2.56.0.2 also carries other changes such as OpenSSL 3.5.9, so treat a rollback only as a stopgap until you can update.
By the same mechanism, any other tool or script that sets GIT_CONFIG_GLOBAL=NUL hits the same error on 2.56.0, and the fix is the same. For Gemini CLI install and login errors, see Fix Gemini CLI install and login errors.