我可以使用以下命令启动 VS Code 打开本地文件夹code /path/to/folder
。是否可以通过在命令行上指定计算机和文件夹来打开远程计算机上的文件夹(通过远程 SSH 扩展)?
从 Linux 或 Mac 终端上的 cli:
code --folder-uri=vscode-remote://ssh-remote+<HOSTNAME><ABSOLUTE_PATH>
就像是:
code --folder-uri=vscode-remote://ssh-remote+centos8stream.local/home/guillaume/workspace/
In my ~/.ssh/config
我有的文件:
Host centos8stream.local
Hostname 10.41.11.69
User guillaume
在我的终端中,我可以 ssh 到我的服务器ssh centos8stream.local
然后我可以直接在远程服务器上打开vscode:
code --folder-uri=vscode-remote://ssh-remote+centos8stream.local/home/guillaume/workspace/
我什至在我的中创建了一个别名函数~/.zshrc
file
function rcode() { code --folder-uri=vscode-remote://ssh-remote+$1/home/guillaume/$2 }
然后我只需输入
rcode centos8stream.local workspace/my_project
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)