CheatSheet: How to set up remote development with VS Code using SSH?

The blog post provides a short guide on accessing source code remotely with SSH using VS Code. It covers which of the Visual Studio Code extensions you should install, SSH configuration, connecting to the host, and using VS Code for remote development. The post also includes helpful tips and an example SSH configuration for a Raspberry Pi.

These are the steps that worked for me.

Step 1: Install both Visual Studio Code extensions

Step 2: Ensure you set the SSH configuration right

My blog post CheatSheet: How to access a remote machine with a SSH key? could be helpful.  In the blog post, don’t skip how to configure your `~/.ssh/config` file on your local machine. Here is an example configuration for a Raspberry PI in a local network.

nano ~/.ssh/config
# Raspberry PI
Host 192.168.178.69
  HostName 192.168.178.69
  PreferredAuthentications password
  #IdentityFile ~/.ssh/my_private_key_if_needed
  User pi

Step 3: Select the green connection icon in the left lower corner <> and select “Connect to Host”

Step 4: Insert your ssh command

In the this Raspberry Pi example you need to insert the password later.

Example command:

ssh pi@192.168.178.79

Step 5: Insert your password

Step 6: Wait until the Server is downloaded to the remote machine and installed

  • Download VS Code Server
  • Install VS Code Server

Step 6: When you are connected with the VS Code Server on your remote machine, you can select a folder on your remote machine to add them to your VS Code workspace.

  • In in the left lower corner you notice that you are now connected to your remote machine.
  • Now you can add folders from the remote machine
    • The image below shows the folders in the remote machine.
  • It can be that you need to insert the password again.
  • Trust the source
  • Now you can use VS Code workspace for remote development. You can save the workspace configuration also on your local machine and reused the configuration you configured before.

That’s all …


I hope this was useful to you and let’s see what’s next?

Greetings,

Thomas

#vscode, #remotedevelopment, #remote, #development, #cheatsheet

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Blog at WordPress.com.

Up ↑