A simple automated batch script to fix the Failed to connect over SSH (Client exited with exit_code 1) error when using Zed Editor's remote development feature to connect from macOS/Linux to a Windows Server.
When Zed tries to connect to a Windows machine via SSH, it often fails and drops the connection with exit_code 1. This usually happens because:
- Windows OpenSSH defaults to
cmd.exe, which Zed's remote server protocol might struggle with. - Unnecessary output or progress bars from the shell disrupt the connection stream.
This script runs a single PowerShell command with Administrator privileges to:
- Set PowerShell as the default shell for OpenSSH via the Windows Registry (
HKLM:\SOFTWARE\OpenSSH). - Create a PowerShell profile (if it doesn't exist).
- Add
$ProgressPreference = "SilentlyContinue"to the profile to suppress noisy progress bars that break the SSH stream.
You must run this script on your target Windows Server.
- Download the
fixer.batfile to your Windows machine. - Right-click on
fixer.batand select Run as administrator. (The script will automatically check for admin rights and warn you if you forget). - Once the script says
[SUCCESS], restart the SSH service to apply changes. You can do this by opening PowerShell and running:Restart-Service sshd