5  Visual Studio Code & SSH

This tutorial walks you through creating and connecting to a virtual machine (VM) using the Visual Studio Code Remote - SSH extension.

To review the complete tutorial, take a look at the official VS Code documentation.

5.1 Prerequisites

To get started, you need to have done the following steps:

  1. If you use Windows, you need to install an OpenSSH compatible SSH client (PuTTY is not supported)

  2. Install Visual Studio Code

  3. Install all necessary local VS Code extensions by importing this profile remote-ssh(choose “Import Profile in Visual Studio Code”)

5.2 Connect using SSH

  • Within VS Code, you should see a status bar item at the far left (at the bottom) in VS Code.

  • The Remote Status bar item can quickly show you in which context VS Code is running (local or remote) and clicking on the item will bring up the Remote - SSH command.

  • Choose the “Connect to Host…” command in the Remote-SSH section and connect to the host by entering connection information for your VM in the following format (replace x with your IP): ubuntu@xxx.xxx.xx.xx

  • If propmted, enter your passphrase (SSH-key password) in VS Code.

  • Open VS Code’s integrated terminal (in the menue, select Terminal -> new Terminal), to be able to work inside a bash shell.

5.3 Install extensions on SSH host

Install all locally installed extensions on the SSH host:

  • Go to the Extensions view

  • Go to the “LOCAL” and hide the extensions with the drop down button >

  • Use the cloud button at the right of the “SSH: {Hostname}” title bar.

  • This will display a dropdown where you can select which locally installed extensions to install on your SSH host (select all).