vscode安装remote-SSH

生成🔑

cmd打开输入ssh-keygen -t rsa -b 4096

连接到服务器

~/.ssh/
image.png
把这个拷贝
image.png

写一下config

在C://User/用户名/.ssh/config文件

  1. # Read more about SSH config files: https://linux.die.net/man/5/ssh_config
  2. Host yuechan
  3. HostName (此处写ip地址)
  4. User root
  5. IdentityFile "C:\Users\(此处是用户名)\.ssh\id_rsa"
  6. # host是我自己设的服务器名字
  7. # hostname是服务器ip地址
  8. # 用户名使用的root比较方便
  9. # identityfile是私钥文件id_rsa

如果连接过其他服务器导致连接不上

删掉known_host文件重试
image.png