- 存放代码的机器开启ssh服务(比如linux的 sshd), vscode 所在机器保证可以通过 ssh 登录服务器
- vscode 机器通过 ssh-keygen 生成 ssh 公私钥对(已有可以忽略)
- 将客户端的 id_rsa.pub 加入到服务器的鉴权队列
cat id_rsa.pub >> authorized_keys - vscode 配置ssh登录即可.ctrl+p, remote-ssh: open ssh configuration file…
IdentityFile 是本机 id_rsa.pub 所在目录
HostName 是远端的ip
Port 是ssh端口
User 是用户名
Host ubuntu-ssh-login
HostName xxx.xxx.xxx.xxx
Port 22
User user_name
IdentityFile "C:\Users\xxx\.ssh\id_rsa"