$ ssh-keygen -t ed25519 -C "your_email@example.com"
或者ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
Enter a file in which to save the key (/c/Users/you/.ssh/id_algorithm):[Press enter]
复制并自定义名字,回车 /c/Users/you/.ssh/id_algorithm_CUSTOMIZED_NAME- passphrase 可以不输入,连按两次回车.
- 这时 ~/.ssh/目录下生成两个文件: id_algorithm_CUSTOMIZED_NAME 私钥;id_algorithm_CUSTOMIZED_NAME.pub 公钥
- 将公钥添加到Github 账户: 复制id_algorithm_CUSTOMIZED_NAME.pub 的内容,全部黏贴:
- 打开 ssh-agent:
eval "$(ssh-agent -s)"
- 添加私钥:
ssh-add ~/.ssh/id_algorithm_CUSTOMIZED_NAME
- 此时使用 git clone 不会再出现 permission denied 情况