1. Install the Remote - SSH Extension:
- Open VS Code.
- Navigate to the Extensions view by clicking on the square icon in the Activity Bar on the side or pressing
Ctrl+Shift+X (Cmd+Shift+X on macOS).
- In the search bar, type
Remote - SSH and select the extension authored by Microsoft.
- Click 'Install' to add the extension to VS Code.
2. Configure the SSH Connection:
- Press
F1 (or Ctrl+Shift+P / Cmd+Shift+P on macOS) to open the Command Palette.
- Type
Remote-SSH: Add New SSH Host... and select it.
- Enter your SSH connection string in the format
your_username@remote_server_address (e.g., [email protected]).
- Choose the SSH configuration file to update when prompted. The default is usually
~/.ssh/config.
3. Connect to the Remote Host:
- Press
F1 (or Ctrl+Shift+P / Cmd+Shift+P on macOS) to open the Command Palette again.
- Type
Remote-SSH: Connect to Host... and select it.
- Choose the host you just added from the list.
- If prompted, select the platform of the remote host (e.g., Linux).
- VS Code will initiate the connection and open a new window connected to the remote host.
4. Open a Folder on the Remote Server:
- In the new VS Code window, click on 'File' in the menu bar.
- Select 'Open Folder...'.
- Navigate to the desired directory on the remote server and click 'OK' or 'Open'.