Reputation: 1714
With the ssh extension of vscode I can open remotedir
in remotehost
via the UI. Similarly to how you can invoke code localdir
in the command line, is it possible to do something like code remotedir --host remotehost
? If not, would there be a way to write a script to achieve something like that?
Upvotes: 10
Views: 3067
Reputation: 302
Use:
code --folder-uri "vscode-remote://ssh-remote+remote_server/folder/on/remote/host/here
To also specify the user:
code --folder-uri "vscode-remote://ssh-remote+remote_user@remote_server/folder/on/remote/host/here
Upvotes: 12
Reputation: 2065
If what you're actually wanting to do is automatically connect to a Remote Explorer ssh target directory from the command line, a way to do this would be to connect normally in vscode, save the workspace, then open the workspace from the command line, it should autoconnect back to the same ssh host and directory.
Upvotes: 0
Reputation: 461
You can start a GUI on your remote pc from your local display here check this out or you can configure a VNC server tutorial and connect to your remote machine via a VNC client real vnc after all of this, you can either view the remote screen from SSH or from VNC. I recommend using VNC. so you can have full control of your remote host.
after the screen share is done you can either use terminal code .
to open the vs code inside your project folder or use application to open the folder directly.
Upvotes: 0
Reputation: 965
I am not completely sure if this is what you are looking for, but can you check Code Server.
It runs VS Code remotely and you can access its UI using a Browser.
Upvotes: 0
Reputation: 717
One way has been described in the link below: Remote Development using SSH.
As you can see in the middle of the page, "Opening a terminal on a remote host", it points out you have to establish an ssh connection first then when you write code .
will automatically run on the remote host rather than locally.
Hope it works.
Upvotes: 0