Skip to content

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

Closed as not planned
Closed as not planned

Description

@pjhool

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

Activity

  1. github-actions commented on Jan 30, 2026

    @github-actions
    Contributor

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

    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.

  2. DaveW001 commented on Jan 30, 2026

    @DaveW001

    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.

  3. xq114 commented on Feb 22, 2026

    @xq114

    I workaround it by disabling hook non-interactive-env in oh-my-opencode.json:

    {
      "$schema": "https://raw.githubusercontent.com/code-yeongyu/oh-my-opencode/master/assets/oh-my-opencode.schema.json",
      "disabled_hooks": ["non-interactive-env"]
    }
    
  4. franshjy commented on Mar 3, 2026

    @franshjy

    I workaround it by disabling hook non-interactive-env in oh-my-opencode.json:

    {
      "$schema": "https://raw.githubusercontent.com/code-yeongyu/oh-my-opencode/master/assets/oh-my-opencode.schema.json",
      "disabled_hooks": ["non-interactive-env"]
    }
    

    Can vouch for this, although not sure perhaps this might me an omo issue?

  5. BeanYa commented on Mar 24, 2026

    @BeanYa

    I ran commands and opencode just got a death loop on running 'export' while I was working on Windows Powershell.

    This works for me:

    I workaround it by disabling hook non-interactive-env in oh-my-opencode.json:我通过在 oh-my-opencode.json 中禁用钩子 non-interactive-env 来解决这个问题:

    {
      "$schema": "https://raw.githubusercontent.com/code-yeongyu/oh-my-opencode/master/assets/oh-my-opencode.schema.json",
      "disabled_hooks": ["non-interactive-env"]
    }
    
  6. github-actions commented on Jul 3, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions