Unable to open files in VS Code via terminal over SSH

2.1k views Asked by At

I have a windows10 machine using Remote-SSH to interface with repo on an Ubuntu18.04 system.

Until about a month ago I was able to open files using VS Code's integrated terminal. Now entering code ./myFile.txt returns immediately. No error, no file opened.

If a non existent file is opened code ./myNonExistentFile.txt the same thing happens.

Running code ./myFile.txt into an entirely local setup (no Remote-SSH) works; the file opens in VS Code. Remote-SSH is otherwise working.

Has anybody else noticed this behavior?

3

There are 3 answers

1
Max Lobur On

It's expected. You probably don't have vs-code on a remote machine, nor have forwarded the X-server thus nothing will happen when you run this.

I suggest mounting the remote file system to local machine and run code . locally: https://www.digitalocean.com/community/tutorials/how-to-use-sshfs-to-mount-remote-file-systems-over-ssh

1
Akif On

@Max Lobur may be right. If not, you still feel free to restart the VS Code.

0
mrn_gomez On

As a last resort, try deleting your server's .vscode-server folder, which is located at your home folder, as detailed in https://github.com/microsoft/vscode-remote-release/issues/1443