github ssh链接失效修复记录

问题

windows10使用ssh-keygen -t rsa重新生成密钥并配置到github 设置后,一直无法连接github,无法push,ssh -T git@github.com提示kex_exchange_identification: Connection closed by remote host

解决

  1. 在申请ssh秘钥之前,首先要重置全局git用户名和邮箱地址。
1
2
$ git config --global user.name "xxx"
$ git config --global user.email "xxx@qq.com"
  1. 使用下面的命令生成秘钥,注意这里一定要加上上面注册的那个邮箱地址
1
2
$ ssh-keygen -t rsa -C "xxx@qq.com"
一路回车,密码为空。
  1. 将_rsa.pub文件中的密码复制粘贴到git或者码云中
  2. 成功
参考

https://blog.csdn.net/weixin_33708432/article/details/88599547