SSH and SFTP Edit files with Visual Studio Code

Deutsch

Edit files with Visual Studio Code

Open your site's files in VS Code over SFTP, or with Remote-SSH on a site that has a full shell.

VS Code's Remote - SSH extension runs a small VS Code server on the server. That needs a full shell; the standard chrooted access has no room for it. With the standard access, use an SFTP extension instead, or ask us for a full shell.

Before you begin

Your key is on your site, and an entry for it in ~/.ssh/config (see Connect with the macOS Terminal).

Steps

  1. In VS Code, open Extensions and install Remote - SSH (by Microsoft), or an SFTP extension such as SFTP by Natizyskunk.
  2. Remote - SSH: press F1, choose Remote-SSH: Connect to Host and pick the host from your ~/.ssh/config.
  3. Choose Linux as the platform and open the folder httpdocs.
  4. SFTP extension: press F1, choose SFTP: Config, enter the host, "port": 7822, your login, "privateKeyPath" and "remotePath": "/httpdocs", and save.
  5. Edit and save files; they go to the server.

Result

You edit your site's files directly in VS Code.

What to do next

Caution

Changes are live at once. On an Exponential site, prefer changes in a copy, and keep backups in mind (see Restore your site from a backup).