To remotely work on a server in VSCode via SSH start by installing the extension Remote - SSH by Microsoft:
![](https://s3.amazonaws.com/making-the-internet/vscode-remote-ssh-extension@2x.png)
Configure new connection
Once the extension is installed, click the remote connection button on the bottom left of your VSCode window:
![Remote connection icon in VSCode’s Remote SSH Extension](https://s3.amazonaws.com/making-the-internet/vscode-remote-connection-button@2x.png)
In the command palette that pops up, choose Connect to host...:
![Connect to host dialog in VSCode’s Remote SSH Extension](https://s3.amazonaws.com/making-the-internet/vscode-remote-ssh-connect-to-host@2x.png)
Then choose Configure SSH Hosts:
![Configure SSH hosts in VSCode’s Remote SSH Extension](https://s3.amazonaws.com/making-the-internet/configure-ssh-hosts@2x.png)
Select the first config file it lists. For example, my SSH config file is located at /Users/Susan/.ssh/config
:
![Select SSH config file in VSCode’s Remote SSH Extension](https://s3.amazonaws.com/making-the-internet/select-config-file@2x.png)
In your SSH config file, we’re going to add connection information for the server you want to connect to. Here is what that connection information should look like:
Host my-server
HostName your.server.ip.address
User root
- Update
my-server
to be some alias for this connection. - Update
your-server-ip-address
to match the IP address of the server you’re connecting to. - Update
root
to whatever user you connect to this server as.
After adding these lines, save your changes.
Example:
![](https://s3.amazonaws.com/making-the-internet/ssh-config-block@2x.png)
Connect
Let’s now connect to the server we just configured.
Click the connection icon (bottom left of VSCode window) again. In the command palette that pops up, choose Connect Current Window to Host... and choose the host you just added:
![Connect Current Window to Host](https://s3.amazonaws.com/making-the-internet/connect-current-window-to-host@2x.png)
This should establish a new remote connection with your server.
Note that anything you do in this window will now occur on your server.
You can tell when a VSCode window is connected to the server by the remote development button/icon on the bottom left of the screen:
![](https://s3.amazonaws.com/making-the-internet/vscode-connected-to-host@2x.png)
Install extensions on server
Not all the VSCode extensions you’ve installed locally will be automatically be available when connected to your server; you’ll need to install them there.
To do this, open your Extensions and find any extensions that are greyed out and choose Install in SSH.
![Installing extensions on server](https://s3.amazonaws.com/making-the-internet/install-in-ssh@2x.png)
I suggest only installing extensions you really need/use, as an excessive amount of extensions can slow down the remote development process.
Connection issues?
If you’re working on a budget server with not a lot of RAM, you might run into issues where the connection frequently stalls while using the Remote SSH plugin.
Symptoms include repeatedly seeing the dialog Disconnected. Attempting to reconnect...
![Stuck on Setting up SSH Host Initializing VSCode when using SSH Remote Development extension](https://s3.amazonaws.com/making-the-internet/vscode-remote-ssh-disconnected-attempting-to-reconnect@2x.png)
Or being stuck on the notification Setting up SSH Host [...] Initializing VSCode
![Disconnected. Attempting to reconnect... dialog in VSCode when using the Remote Development SSH extensions](https://s3.amazonaws.com/making-the-internet/vscode-remote-ssh-setting-up-ssh-host-initializing-vscode@2x.png)
If this happens to you, see my guide: VSCode Remote SSH Keeps disconnecting.