## 插件
- VSCode Remote Development
## 步骤
1. 在远程主机中打开或创建`~/.ssh/config`,增加一行`PubkeyAuthentication yes`。
2. 在远程主机中打开或创建`~/.ssh/authorized_keys`。
3. 在本地找到`.ssh/id_rsa.pub`或以`.pub`为后缀的公钥文件。
4. 将公钥的内容复制到远程主机的`~/.ssh/authorized_keys`中。
5. 在本地找到`~/.ssh/config`,增加如下内容:
```plaintext
Host example.com
HostName example.com
User exampleUser
IdentityFile ~/.ssh/id_rsa
```
若已连接过,则只需要在后面增加`IdentityFile`的内容。
6. 在VSCode中打开命令面板(查看->命令面板),输入`Remote-SSH:Settings`,设置`Remote.SSH:Config File`为`~/.ssh/config`。
7. VSCode左下角绿色图标打开远程窗口,选择`Connect to Host...`,然后选择`example.com`即可。

0 Comments latest
No comments.