• 打开 Git Bash,输入如下命令,然后连续按三个回车即可:

    • ssh-****** -t rsa -C "your_email"
    • 这是我的邮箱:ssh-****** -t rsa -C "[email protected]"
    • 注意:其中 C:/Users/w'w'w/.ssh/id_rsa 保存的为**,C:/Users/w'w'w/.ssh/id_rsa.pub 保存的为公钥
  • 将SSH私钥添加到 ssh-agent

    • eval ssh-agent -s

    • ssh-add ~/.ssh/id_rsa

    • 如果出现以下情况:

      • Windows下配置Github 的SSH Key

    • 执行 ssh-agent bash 后,再执行 ssh-add ~/.ssh/id_rsa

  • 将SSH公钥添加到GitHub账户

    • 先复制 SSH 公钥的完整内容(C:/Users/w'w'w/.ssh/id_rsa.pub)
    • 进入GitHub的设置页面(登录GitHub,在右上角)
      • Windows下配置Github 的SSH Key
    • 点击左部侧边栏的 SSH and GPG keys 选项
      • Windows下配置Github 的SSH Key
    • 点击 New SSH key按钮
      • Windows下配置Github 的SSH Key
    • 在 Title 输入框内,为你的新 key 取个名字,在 Key 输入框内,粘贴前面复制好的公钥内容,然后点击 Add key 按钮即可。
      • Windows下配置Github 的SSH Key
  • 测试连接

    • 打开 Git Bash 输入: ssh -T [email protected]
    • 输入 yes 后回车
    • 如果提示中的用户名是你的,说明SSH key已经配置成功

相关文章:

  • 2022-12-23
  • 2022-02-10
  • 2021-09-24
  • 2021-10-10
  • 2021-10-22
  • 2021-09-02
  • 2021-05-15
  • 2021-10-26
猜你喜欢
  • 2022-12-23
  • 2021-09-01
  • 2022-12-23
  • 2021-11-08
相关资源
相似解决方案