在Windows中添加git ssh key

  1. $ ssh-keygen -t ed25519 -C "your_email@example.com" 或者 ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
  2. 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
  3. passphrase 可以不输入,连按两次回车.
  4. 这时 ~/.ssh/目录下生成两个文件: id_algorithm_CUSTOMIZED_NAME 私钥;id_algorithm_CUSTOMIZED_NAME.pub 公钥
  5. 将公钥添加到Github 账户: 复制id_algorithm_CUSTOMIZED_NAME.pub 的内容,全部黏贴:
  6. 打开 ssh-agent: eval "$(ssh-agent -s)"
  7. 添加私钥: ssh-add ~/.ssh/id_algorithm_CUSTOMIZED_NAME
  8. 此时使用 git clone 不会再出现 permission denied 情况
原文地址:https://www.cnblogs.com/mrlonely2018/p/15423986.html