Skip to content

Visual Studio Code Remote SSH

You can edit files on a remote server over SSH in VS Code using the official Remote - SSH extension by Microsoft. This extension allows you to work with files and folders on the remote machine as if they were local, while still utilizing all of VS Code's features. [1, 2, 3]

Install the Remote - SSH Extension

  • Open VS Code and go to the Extensions view by clicking the square icon in the sidebar or pressing Ctrl+Shift+X.
  • Search for "Remote - SSH".
  • Select the extension by Microsoft and click Install. [1, 4]

Connect to a Remote Host

  • Open the Command Palette by pressing F1 or Ctrl+Shift+P.
  • Type and select Remote-SSH: Connect to Host....
  • Enter the connection information in the format user@hostname or user@ip_address (e.g., john_doe@server.com).
  • VS Code will prompt you to select an SSH configuration file to save the connection details. Select the appropriate one for your operating system.
  • Enter your password or use key-based SSH authentication for a seamless experience.
  • A new VS Code window will open and connect to the remote server. The status bar in the bottom-left corner will indicate the active SSH connection. [1, 2, 3, 4, 5, 6, 7]

Open and Edit Files

  • Once connected, you can open the Explorer view (Ctrl+Shift+E) and click Open Folder to browse the remote machine's filesystem.
  • Select the desired directory on the remote server.
  • You can now open, edit, save, and manage files on the remote server exactly as you would local files, with full access to VS Code features like syntax highlighting, IntelliSense, and integrated source control (Git). [2, 8, 9, 10, 11]

Use the Integrated Terminal

  • Any new terminal you open (Ctrl+\``) within the connected VS Code window will automatically run on the remote server, allowing you to execute commands directly on the host machine. [2]

For more detailed information, consult the official Visual Studio Code documentation. [12, 13]