Codex Desktop creates empty .git directory when apply_patch modifies files

Open 💬 1 comment Opened Jun 25, 2026 by simplearebest

What version of the Codex App are you using (From “About Codex” dialog)?

26.616.81150

What subscription do you have?

ChatGPT Plus

What platform is your computer?

Windows 11

What issue are you seeing?

Codex Desktop creates an empty .git directory inside the workspace root when apply_patch modifies files.

Environment:

  • Codex Desktop
  • Windows
  • Workspace root: D:\git\project\xxx
  • Actual Git repository root: D:\git\project
  • The workspace root is a subdirectory of the real Git repository.

Observed behavior:
When apply_patch modifies any file under D:\git\project\xxx, Codex creates an empty directory:

D:\git\project\xxx\.git

This directory did not exist before the patch operation. It is empty and is not a valid Git repository.

Impact:
The empty .git directory breaks Git discovery. Running Git commands from D:\git\project\xxx then fails because Git finds the empty .git directory first instead of walking up to the real repository at D:\git\project\.git.

Expected behavior:
Codex should not create a .git directory inside the workspace root. If the workspace is a subdirectory of a Git repository, Git discovery should continue to use the parent repository, or Codex should leave the filesystem unchanged.

Reproduction:

  1. Open Codex Desktop with workspace root D:\git\project\xxx.
  2. Ensure D:\git\project\xxx\.git does not exist.
  3. Modify a file using apply_patch.
  4. Check D:\git\project\xxx\.git.
  5. An empty .git directory has been created.

Notes:
No git init command was executed. Read-only shell commands such as Get-Content and Select-String do not create the directory. The directory appears immediately after apply_patch writes a file.

What steps can reproduce the bug?

Feedback ID: 019ef9d8-b677-7903-bcee-53e9390320a2

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗