Execute git operations using cmd /c on windows fails #8035

Open
opened 2026-02-16 18:08:58 -05:00 by yindo · 2 comments
Owner

Originally created by @pjhool on GitHub (Jan 30, 2026).

Originally assigned to: @rekram1-node on GitHub.

Description

$ export CI=true DEBIAN_FRONTEND=noninteractive GIT_TERMINAL_PROMPT=0 GCM_INTERACTIVE=never HOMEBREW_NO_AUTO_UPDATE=1 GIT_EDITOR=: EDITOR=: VISUAL='' GIT_SEQUENCE_EDITOR=: GIT_MERGE_AUTOEDIT=no GIT_PAGER=cat PAGER=cat npm_config_yes=true PIP_NO_INPUT=1 YARN_ENABLE_IMMUTABLE_INSTALLS=false; export CI=true DEBIAN_FRONTEND=noninteractive GIT_TERMINAL_PROMPT=0 GCM_INTERACTIVE=never HOMEBREW_NO_AUTO_UPDATE=1 GIT_EDITOR=: EDITOR=: VISUAL='' GIT_SEQUENCE_EDITOR=: GIT_MERGE_AUTOEDIT=no GIT_PAGER=cat PAGER=cat npm_config_yes=true PIP_NO_INPUT=1 YARN_ENABLE_IMMUTABLE_INSTALLS=false; git branch && git status

'export' is not recognized as an internal or external command,
operable program or batch file.

Plugins

No response

OpenCode version

v1.1.42

Steps to reproduce

No response

Screenshot and/or share link

Image

Operating System

No response

Terminal

No response

Originally created by @pjhool on GitHub (Jan 30, 2026). Originally assigned to: @rekram1-node on GitHub. ### Description $ export CI=true DEBIAN_FRONTEND=noninteractive GIT_TERMINAL_PROMPT=0 GCM_INTERACTIVE=never HOMEBREW_NO_AUTO_UPDATE=1 GIT_EDITOR=: EDITOR=: VISUAL='' GIT_SEQUENCE_EDITOR=: GIT_MERGE_AUTOEDIT=no GIT_PAGER=cat PAGER=cat npm_config_yes=true PIP_NO_INPUT=1 YARN_ENABLE_IMMUTABLE_INSTALLS=false; export CI=true DEBIAN_FRONTEND=noninteractive GIT_TERMINAL_PROMPT=0 GCM_INTERACTIVE=never HOMEBREW_NO_AUTO_UPDATE=1 GIT_EDITOR=: EDITOR=: VISUAL='' GIT_SEQUENCE_EDITOR=: GIT_MERGE_AUTOEDIT=no GIT_PAGER=cat PAGER=cat npm_config_yes=true PIP_NO_INPUT=1 YARN_ENABLE_IMMUTABLE_INSTALLS=false; git branch && git status 'export' is not recognized as an internal or external command, operable program or batch file. ### Plugins _No response_ ### OpenCode version v1.1.42 ### Steps to reproduce _No response_ ### Screenshot and/or share link ![Image](https://github.com/user-attachments/assets/a7d85426-9e0f-4e10-ab1b-84c2a9710c7d) ### Operating System _No response_ ### Terminal _No response_
yindo added the windowsbug labels 2026-02-16 18:08:58 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 30, 2026):

This issue might be a duplicate of or related to existing issues. Please check:

  • #631: Windows Support (umbrella issue for all Windows-related problems)
  • #10871: Git Bash auto-detection on Windows
  • #6488: Bash Fork Issues on Windows
  • #10538: Ctrl-C crashes on Windows (similar shell handling issue)
  • #10719: Terminal state not restored when exiting with ctrl+c on Windows

Root Cause: The error message 'export is not recognized as an internal or external command' indicates that bash shell syntax is being executed in Windows cmd.exe, which doesn't support the 'export' command. This is a shell mismatch issue where bash commands are being sent to cmd.exe instead of being properly executed in a bash shell.

Feel free to ignore if none of these address your specific case, but checking #631 (the Windows support umbrella) and #10871 (bash auto-detection) would be most relevant.

@github-actions[bot] commented on GitHub (Jan 30, 2026): This issue might be a duplicate of or related to existing issues. Please check: - #631: Windows Support (umbrella issue for all Windows-related problems) - #10871: Git Bash auto-detection on Windows - #6488: Bash Fork Issues on Windows - #10538: Ctrl-C crashes on Windows (similar shell handling issue) - #10719: Terminal state not restored when exiting with ctrl+c on Windows **Root Cause:** The error message 'export is not recognized as an internal or external command' indicates that bash shell syntax is being executed in Windows cmd.exe, which doesn't support the 'export' command. This is a shell mismatch issue where bash commands are being sent to cmd.exe instead of being properly executed in a bash shell. Feel free to ignore if none of these address your specific case, but checking #631 (the Windows support umbrella) and #10871 (bash auto-detection) would be most relevant.
Author
Owner

@DaveW001 commented on GitHub (Jan 30, 2026):

Reproduced this behavior with a slightly different signature affecting PowerShell.

Additional Symptoms:

  • Shell: PowerShell
  • Error: CommandNotFoundException on the = token (caused by VAR=val syntax).
  • Artifacts: Creation of a file named nul in the working directory (caused by > /dev/null redirection failing in Windows).

This confirms the issue affects both CMD (reporting export error) and PowerShell (reporting = error).

Likely caused by #10871 (failed Bash detection) causing fallback to native Windows shells while passing Bash-specific syntax.

@DaveW001 commented on GitHub (Jan 30, 2026): Reproduced this behavior with a slightly different signature affecting PowerShell. **Additional Symptoms:** - **Shell:** PowerShell - **Error:** `CommandNotFoundException` on the `=` token (caused by `VAR=val` syntax). - **Artifacts:** Creation of a file named `nul` in the working directory (caused by `> /dev/null` redirection failing in Windows). This confirms the issue affects both CMD (reporting `export` error) and PowerShell (reporting `=` error). Likely caused by #10871 (failed Bash detection) causing fallback to native Windows shells while passing Bash-specific syntax.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8035