

Wouldn’t it be nice to have VS Code automatically open to the correct folder once your SSH connection is established? Unfortunately there isn’t a way to set a folder location in the settings yet you’d need to click Open Folder and navigate to the project root every time you connect. You’re now connected and can use VS Code’s features like Terminal and Debug Console just like you would locally. If your key is on the server, it will state it has your fingerprint and prompt you to continue. If your public SSH key isn’t on the remote server, you will be prompted to enter a password. You can find more details on these commands in the SSH client configuration man page.Click the green Open a Remote Window icon on the bottom left corner, select Connect to Host., and pick your desired host, in this case MySite. You can also specify port forwarding if you use local ports on the remote host debug as well. For example, instead of jump-host you can name it work-machine and change it’s hostname anytime you need to switch remote machines without having to modify any of VS Code settings. I like this way because it moves the details of connections, host names etc away from VS Code and make them independently configurable. We have to specify that client what is our hosts, where to jump from etc. The reason we need to configure the jump host this way is because VS Code, practically so, delegates the connection responsibilities to the underlying ssh client. Feel free to continue reading for further insights and discussion.

It should first connect to the jump host and from there reach the remote host you desire. Now in VS Code, using the remote SSH extension, you just need to say ssh remote-host (no need for the full domain name either since we specified it). I’d strongly recommend you setup your SSH keys from your local machine -> jump-host and jump-host -> remote-host so VS Code does not have to deal with passwords when trying to connect.If you are on Windows, you might need to replace ssh inside the Prox圜ommand with ssh.exe depending on which is available in your shell.# as the jump-host would see it since we will be connecting # Now we will specify the actual remote host with # we just tell what the host name is for now. # Specify our intermediate jump host, nothing fancy here # active if there is no activity to avoid unwanted disconnects

# We will set a 1 minute keep alive to keep the connection
