coder icon indicating copy to clipboard operation
coder copied to clipboard

coder config-ssh generates backslash paths that break with Git Bash SSH on Windows

Open jku-sr opened this issue 7 months ago • 1 comments

Description

coder config-ssh on Windows generates ~/.ssh/config entries with backslash paths in ProxyCommand and Match directives:

ProxyCommand C:\Users\me\AppData\Local\Microsoft\WinGet\Packages\Coder.Coder_Microsoft.Winget.Source_8wekyb3d8bbwe\coder.exe --global-config C:\Users\me\AppData\Roaming\coderv2 ssh --stdio --ssh-host-prefix coder. %h

When Git Bash's OpenSSH (C:\Program Files\Git\usr\bin\ssh.exe) is first in PATH — which is common on Windows developer machines — it executes ProxyCommand via /bin/sh -c "...". The /bin/sh shell interprets backslashes as escape characters, stripping them and mangling the path:

/bin/sh: line 1: C:UsersMeAppDataLocalMicrosoftWinGetPackagesCoder.Coder_Microsoft.Winget.Source_8wekyb3d8bbwecoder.exe: command not found

This breaks Coder Desktop File Sync (mutagen) with the error:

unable to copy agent binary: unable to run SCP process: /bin/sh: line 1: C:Users...coder.exe: command not found

Expected behavior

coder config-ssh should generate forward-slash paths on Windows:

ProxyCommand C:/Users/me/AppData/Local/Microsoft/WinGet/Packages/Coder.Coder_Microsoft.Winget.Source_8wekyb3d8bbwe/coder.exe --global-config C:/Users/me/AppData/Roaming/coderv2 ssh --stdio --ssh-host-prefix coder. %h

Forward slashes work with both Windows native OpenSSH (C:\Windows\System32\OpenSSH\ssh.exe) and Git Bash's OpenSSH, making the generated config portable across SSH implementations.

Environment

  • OS: Windows 11 Enterprise
  • Coder CLI: v2.33.0-rc.0 (installed via WinGet)
  • Coder Desktop: v0.8.2
  • Git Bash SSH: OpenSSH 10.2p1 (C:\Program Files\Git\usr\bin\ssh.exe)
  • Windows native SSH: OpenSSH for Windows 9.5p2 (C:\Windows\System32\OpenSSH\ssh.exe)

Workaround

After running coder config-ssh, convert backslashes to forward slashes in the generated block:

sed -i '/START-CODER/,/END-CODER/s|\|/|g' ~/.ssh/config

jku-sr avatar Apr 09 '26 15:04 jku-sr

Use coder config-ssh --force-unix-filepaths

Opened a PR to add this to the docs

Emyrk avatar May 11 '26 17:05 Emyrk