- 存放代码的机器运行 sshd,使用 vscode 的机器保证可以通过 ssh 登录服务器
- vscode 机器通过 ssh-keygen 生成 ssh 公私钥对
- 将客户端的 id_rsa.pub 加入到服务器的鉴权队列 cat id_rsa.pub >> authorized_keys
- vscode 配置即可.ctrl+p, remote-ssh: open ssh configuration file…
Host ubuntu
HostName xxx.xxx.xxx.xxx
Port 22
User user_name
IdentityFile “C:\Users\xxx.ssh\id_rsa”
参考资料 https://zhuanlan.zhihu.com/p/222452460