A: github推送和拉取报错:
kex_exchange_identification: read: Connection reset by peer
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Q: 我选择重新生成SSH key,具体步骤如下:
-
本地生成SSH key ssh-keygen -t rsa -C "example@example.com"
生成SSH Key的秘钥对:id_rsa 和id_rsa.pub ,id_rsa是私钥,不能泄露,id_rsa.pub是公钥,可以公开,分别的默认生成路径为 Windows:C:\Users\$Name\.ssh Ubuntu:~/.ssh -
配置GitHub 点击右上角头像 ==》选择Settings ==》左侧菜单栏选择SSH and GPG keys ==》点击SSH keys区域的New SSH key ==》复制本地id_rsa.pub 到Key区域并在Title区域命名。 -
验证连接情况 执行命令 ssh -T git@github.com
初次设置会提醒Are you sure you want to continue connecting (yes/no/[fingerprint])? ,输入yes 如果是kex_exchange_identification: read: Connection reset by peer 请看后续问题。
A1: 执行ssh -T git@github.com 提示kex_exchange_identification: read: Connection reset by peer Q1: 到密钥生成的文件夹执行以下命令
ssh-add id_rsa
A2: 执行ssh-add id_rsa 报错Could not open a connection to your authentication agent. Q2: 执行以下命令
ssh-agent bash
|