如何解决Github报“Could not read from remote repository”的问题

2022-06-16大约3分钟

使用Github,有时候会出现连不上的问题。比如这样的错误:

Connection reset by xxx.xxx.xxx.xxx port 22

fatal: Could not read from remote repository.

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

如果出现这种情况,一般是因为使用了SSH的Github链接,比如git@github.com:xxx.git

首先可以试试换成HTTPS的链接,然后再试试看问题是否解决。

切换Git仓库的链接,可以编辑项目根目录下的.git/config文件里的[remote "origin"] url的内容。