VS Code Connection (Windows/WSL)
This guide helps you configure VS Code to connect to Brev instances when using Windows with WSL (Windows Subsystem for Linux).
Platform: Windows with WSL (Ubuntu or similar)
Problem
When running the following command to open a Brev instance in VS Code:
The connection fails with errors such as:
VS Code does not successfully establish an SSH session to the instance.
Root Cause
When launching VS Code from WSL (for example, via brev open <instance_name> code), the editor runs as a Windows application and uses the Windows SSH client by default.
Although the .brev directory (SSH config and private key) is correctly synced from WSL to Windows, the cloudflared binary is not available to the Windows SSH client. Cloudflare Tunnel requires cloudflared to be executed as part of the SSH ProxyCommand, which Windows SSH cannot do when the binary exists only inside WSL.
As a result, VS Code fails to connect to Brev instances that depend on Cloudflare Tunnel-based SSH access.
Prerequisites
- Windows host with VS Code installed
- WSL (for example, Ubuntu) configured and functional
- Brev CLI installed and authenticated in WSL
Solution
Configure VS Code to use the WSL SSH client instead of the Windows SSH client.
Create a wrapper BAT file
Create a file on Windows (for example, C:\Users\<username>\wsl-ssh.bat) with the following content:
This wrapper redirects SSH commands invoked by VS Code to the WSL SSH client.
Verification
After completing the configuration:
- VS Code successfully connects to the instance over SSH
- Cloudflare Tunnel-based connections work without
posix_spawnpor SSH binary errors - You can browse files and use the integrated terminal on the remote instance
Rollback
To revert to the default configuration:
- Open VS Code Settings
- Search for “remote.SSH.path”
- Clear the value to restore the default
- Restart VS Code
Workaround
If you cannot configure VS Code, use a terminal-based SSH connection from WSL instead:
This provides full terminal access to the instance without requiring VS Code Remote SSH integration.