Skip to content

Remote SSH

Thomas Hahn edited this page Dec 11, 2024 · 5 revisions

The Remote-SSH extension lets us use a remote machine as our development environment while running VS Code locally. The source code is located on the remote machine.

Preliminary setup

We are assuming the following tasks have been done beforehand:

  • The remote host that we want to connect to is defined in the local SSH configuration file ~/.ssh/config.
  • The toy repository has been cloned and set up on the remote machine as described in Basic VS Code setup.

Install the extension

To install/enable the extension, follow the same steps as in the previous sections.

remote_ext

Get started

Connect to Host

To establish a connection to the remote machine,

  • Run >Remote-SSH: Connect to Host...
  • Select your host from the pop up window (workstation in our case)
remote_connect

This opens a new VS Code window that is connected to the remote host (see bottom left corner):

remote_new_window

In our case it shows SSH: workstation since workstation is the name of our remote host.

Install extensions on the remote machine

Just like we did in the previous sections, we can install extensions on the remote machine.

  • Go to Extensions in the activity bar

VS Code shows you all the extensions which are installed locally and on the remote machine. It will also disable certain local extensions if they cannot be used on the remote machine.

To install an extension remotely, simply select a greyed out local extension and click Install in SSH: workstation:

remote_install_ext

Settings on the remote machine

To modify VS Code user settings on the remote machine,

  • Run >Preferences: Open Remote Settings (JSON) (SSH: workstation)

You can simply copy the contents of your local user settings to the remote file.

Note: Be careful to adjust all paths in case they don't make sense for the remote machine. Settings for extensions which are not installed remotely will simply be greyed out and ignored.

Clone this wiki locally