Visual Studio Code (VS Code), through the Remote SSH plugin, allows you to connect to a remote server or virtual machine via SSH directly within your VSCode editor. This enables you to work with code on a remote system as if it were local, with full access to the remote file system and command-line tools.
This guide will walk you through the steps to install, configure, and use the Remote SSH plugin in VS Code.
NOTE: Each time you "Start" your server, it will be given a new IP address. You will have to update your config file with this new IP address each time before connecting with VS Code through the Remote SSH plugin.
Most of you will have VS Code already installed on your computer. If you do not, head to Visual Studio Code and follow the instructions for your operating system.
If you are on Windows, you can also use the Windows Store.
After installing the plugin, you need to configure your SSH settings to connect to a remote server:
Open the Command Palette (Ctrl+Shift+P) and type "Remote-SSH: Open SSH Configuration File".
Select the SSH configuration file to edit from the list provided (e.g., ~/.ssh/config).
Add a new entry for your remote server:
Host [MY_SERVER]
HostName [SERVER_IP_ADDRESS]
User root
IdentityFile [PATH_TO_KEY_FILE]
Replace [MY_SERVER] with a meaningful name, [PATH_TO_KEY_FILE] with the full path including file name for your SSH private key file, and [SERVER_IP_ADDRESS] with the IP address for the server from your dashboard.
Save the file.
Now that your SSH configuration is set up, you can connect to the remote server:
Once connected, you can open a folder on the remote server to start working:
With the Remote SSH plugin in VS Code, you can easily develop and manage code on remote servers or virtual machines. This setup is particularly useful for working on large codebases or when you need access to specific environments that are not available locally.
© Copyright 2024. Make Life Great LLC. All rights reserved.