git push失败:Could not read from remote repository

问题描述
$ git push
Connection reset by ip-address port 22
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

另外,在C:\Users\Administrator.ssh\里面的known_hosts文件里面有几个ip-address,不知道怎么生成的。

我的解决方法

删除C:/Users/Administrator/.ssh/里面的known_hosts文件,然后重新生成id_rsa.pub里面的SHH key,我之前有了,就覆盖掉原本的:Overwrite (y/n)? yes,其他一路enter,最后把id_rsa.pub里面新的key给配置到GitHub里面即可。

$ ssh-keygen -t rsa -C "username"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/Administrator/.ssh/id_rsa):
/c/Users/Administrator/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/Administrator/.ssh/id_rsa.
Your public key has been saved in /c/Users/Administrator/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:GG8cUu3D0RHGrFgeiHbA3CaWyijxSxYuZ3HkwV6fleo qinmeizhen
The key's randomart image is:
+---[RSA 3072]----+
|   ooo.=.o =+o   |
|. o.o.X.= B.+    |
| + B.=o=.X +     |
|o O +  *=.*      |
| B .  ..S  .     |
|  .    .E        |
|                 |
|                 |
|                 |
+----[SHA256]-----+

昨天晚上解决了,今天早上clone的时候遇到这个问题,然后我直接删掉known_hosts文件,再clone,最后到下面一步时输入yes就可以了。

Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

(ps:以后不会每次要这样吧,麻烦,后面有心思的时候再探究一下这到底是什么原因)


版权声明:本文为qmz18778391913原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。