vscode配置ssh免密码
时间: 2023-11-20 22:50:37 浏览: 80
好的,下面是配置 VS Code SSH 免密码的步骤:
1. 在本地生成 SSH 密钥对
打开终端,输入以下命令:
```
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
```
其中,`your_email@example.com` 换成你的邮箱地址。
2. 将公钥复制到远程服务器
输入以下命令:
```
ssh-copy-id user@remote_host
```
其中,`user` 是你在远程服务器上的用户名,`remote_host` 是远程服务器的 IP 地址或域名。
3. 配置 VS Code
打开 VS Code,按下 `Ctrl + Shift + P`,输入 `Remote-SSH: Open Configuration File...`,选择 `~/.ssh/config`。
在文件中添加以下内容:
```
Host remote_host
HostName remote_host
User user
IdentityFile ~/.ssh/id_rsa
```
其中,`remote_host` 和 `user` 分别是远程服务器的 IP 地址或域名和用户名,`~/.ssh/id_rsa` 是你本地生成的私钥文件路径。
4. 连接远程服务器
按下 `Ctrl + Shift + P`,输入 `Remote-SSH: Connect to Host...`,选择 `remote_host`。
现在你就可以在 VS Code 中连接到远程服务器了,无需输入密码。
阅读全文
相关推荐


















