1.本地生成key
ssh-keygen -t ed25519 -C "your_email@example.com"
或者
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
2.公钥上传至github
/c/Users/YOU/.ssh/id_ALGORITHM
找到生成的私钥和公钥文件,打开公钥文件copy放到GitHub即可。
遇到公钥文件打不开情况可用命令行
// 查看公钥文件里文本
$ type id_algorithm.pub
3.验证是否配置成功
ssh -T git@github.com
出现successful即ok。
参考链接:Generating a new SSH key and adding it to the ssh-agent - GitHub Docs