1.windows (win+R) 输入
cmd
2.输入命令
ssh-keygen
3.ssh-keygen 建立全部 enter 跳过
ssh-copy-id -i ~/.ssh/id_rsa.pub username@hostip -p (port)
5.finish
若出现 无法辨识 'ssh-copy-id' 词彙是否为 Cmdlet、函数、
将以下粘贴到 powershell enter执行即可
function ssh-copy-id([string]$userAtMachine, $args){ $publicKey = "$ENV:USERPROFILE" + "/.ssh/id_rsa.pub" if (!(Test-Path "$publicKey")){ Write-Error "ERROR: failed to open ID file '$publicKey': No such file" } else { & cat "$publicKey" | ssh $args $userAtMachine "umask 077; test -d .ssh || mkdir .ssh ; cat >> .ssh/authorized_keys || exit 1" }}