如何使用VS Code Remote-SSH
本文主要介绍如何在Windows环境下配置Remote SSH。主要是按照官方文档Remote Development using SSH来配置并加上一些小trick.
安装
官方教程指明安装需要3步,其中后两步比较简单,就不介绍了。着重介绍如何安装OpenSSH compatible SSH client.
- Install an OpenSSH compatible SSH client if one is not already present.
- Install Visual Studio Code or Visual Studio Code Insiders.
- Install the Remote Development extension pack.
安装 OpenSSH compatible SSH client
1 | # Make sure you're running as an Administrator |
SSH config file
ssh config file 格式如下
1 | # Read more about SSH config files: https://linux.die.net/man/5/ssh_config |
如何根据putty private key 生成 OpenSSH key
- 打开PuTTYgen,点击load,选择putty private key
- 点击Conversions, 选择Export OpenSSH Key。这里的地址就是上面所说的OpenSSH key的地址。
注意点:
这里的地址最好选择 C:\Users\username下面,否则可能因为文件权限过松导致出现如下错误:
Permissions for 'file name' are too open. > It is required that your private key files are NOT accessible by others
VS Code 配置
- 打开VS Code 的settings.
- 搜索Remote.SSH.configFile
- 将上述SSH config file的文件绝对路径填入框中
