Git for Windows: sh.exe fails with CreateFileMapping (Win32 error 5) in non‑interactive automation (Codex tool)

Resolved 💬 3 comments Opened Feb 17, 2026 by mbg033 Closed Feb 24, 2026

Environment

  • OS: Windows 11 24H2
  • Git for Windows: 2.52.0.windows.1
  • Non‑interactive automation environment (Codex tool), PowerShell -NoProfile
  • Same command succeeds in interactive PowerShell terminal

Steps to Reproduce

  1. In a non‑interactive automation tool (Codex) run:

git -C <path_to_git_repo> submodule status

  1. Observe failure.

Actual Result
sh.exe fails with CreateFileMapping … Win32 error 5 and terminates:

sh.exe: *** fatal error - CreateFileMapping S-1-5-21-1712728213-165960617-4115043855-1001.1, Win32 error 5. Terminating.

Expected Result
git submodule status should work in non‑interactive automation, same as in an interactive PowerShell terminal.

Notes

  • Failure is specific to the automation tool / non‑interactive process context.
  • Running the exact same command in interactive PowerShell works.
  • Suggests MSYS2 shared‑memory mapping blocked by policies in non‑interactive context.

Possible Suspects

  • MSYS2 shared memory usage (CreateFileMapping) blocked in non‑interactive/sandboxed context.
  • Temp directory or security policies for non‑interactive processes.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗