github在创建PC连接公钥出错的解决办法
假如执行ssh-keygen -t rsa -C "eric_zhng@hotmail.com"
获取公钥和秘钥的时候出现以下错误
1 | $ ssh-keygen -t rsa -C "eric_zhng@hotmail.com" |
解决办法参考GPT的回复
The error you’re encountering occurs because the path C:\Users\Administrator\github\.ssh
does not exist. When you use ssh-keygen
, it needs to save the key in a valid directory, but this path might not exist yet.
Here’s how you can resolve this issue:
- Create the directory: Make sure the directory
C:\Users\Administrator\github\.ssh
exists before running the command. You can create the directory by running the following command in a Command Prompt or PowerShell:
1 | mkdir C:\Users\Administrator\github\.ssh |
- Run the command again: After creating the directory, rerun the
ssh-keygen
command:
1 | ssh-keygen -t rsa -C "eric_zhng@hotmail.com" -f C:\Users\Administrator\github\.ssh\id_rsa |
The
-f
option is used to specify the file in which to save the private key.
Afterward, you should be able to generate the SSH key without encountering the “No such file or directory” error.
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 駝駱仧🐫!
评论