在Windows10下用VS code编辑服务器的文件
2020-03-30 本文已影响0人
xuzhougeng
前提条件: 你得确保你的Windows10安装了SSH,同时你需要保证的你服务器能通过ssh进行登陆,安装了openssh-client
和openssh-server
因为后续的操作依赖于ssh

第一步: 使用快捷键Ctrl + Shift +X 打开插件面板,然后搜索Remote VSCode, 点击Install

第二步: 你需要在服务器上安装Rmate
git clone https://github.com/hanklords/rmate.c.git
cd rmate.c
make
sudo mv rmate /usr/local/bin
第三步: 用快捷键F1打开VS Code的命令面板,在里面输入Remote: Start Server

第四步: 在Terminal中新建一个终端

第五步: 在VS Code的终端下连接服务器,被代码的部分就是你的服务器IP地址

第六步: 在服务器上用rmate
打开你的目标文件, 例如我这里的rmate.c
rmate -p 52698 rmate.c
你就会发现本地的VS Code就看到了被打开的文件,本地的编辑会同步到服务器上
