Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using remote server in Visual Studio Code terminal?

I recently switched to using Visual Studio Code from Sublime Text and have a question about the terminal functionality. It looks like "Integrated Terminal" that appears at the bottom is mounted to the local file system out of the box.

What I'm wondering is if I can replace this local terminal with a remote server? I have the hostname, port, and login credentials and would love to be able to navigation the file system on our remote server (like using MobaXterm, PuTTy, etc) and then open code files in Visual Studio Code instead of vim or emacs. Is this possible?

Thanks!!

like image 528
Jeff Winkle Avatar asked May 25 '17 15:05

Jeff Winkle


People also ask

How do I connect to a remote server using Visual Studio Code?

Connect to a remote host Verify you can connect to the SSH host by running the following command from a terminal / PowerShell window replacing user@hostname as appropriate. In VS Code, select Remote-SSH: Connect to Host... from the Command Palette (F1, Ctrl+Shift+P) and use the same user@hostname as in step 1.

Can you SSH with Visual Studio?

You can connect over SSH into another machine from Visual Studio Code and interact with files and folders anywhere on that remote filesystem. If you have an app located on a different computer, you could use SSH to connect to it and access your app, view its files, and even modify, run, and debug it.

How do I connect visual codes to a VM?

Click on the indicator to bring up a list of Remote extension commands. Choose the Remote-SSH: Connect to Host command and connect to the host by entering connection information for your VM in the following format: user@hostname . The user is the username you set when adding the SSH public key to your VM.


1 Answers

UPDATE: I have figured out how to rig this into VS code.

You can download git bash online and it will be mounted to your local machine. In VS Code, you can then Ctrl+Shift+P and type "Open User Settings". In the right pane, add this setting:

enter image description here

This will replace the default integrated terminal in VSCode with the git bash CLI client that was just installed in the location in the screenshot above. Now that you have your local file system mounted in VScode, you can execute:

ssh username@hostname -p <port>

like image 72
Jeff Winkle Avatar answered Nov 13 '22 08:11

Jeff Winkle