首页 > 其他分享 >ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repo

ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repo

时间:2023-01-13 22:33:29浏览次数:50  
标签:mylearn code remote 22 github source git ssh


1.问题

换了个wifi,​​git clone​​拉取代码就会报错,切回原来的wifi,又是可以的,反复尝试,最终确认,这个特定的wifi下,网页和命令行都不能访问github,甚是神奇。

G:\mylearn\source-code>git pull
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

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

G:\mylearn\source-code>ssh -T [email protected]
ssh: connect to host github.com port 22: Connection timed out

ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repo_ide

2.解决方案:

在C:\Users\wangzx\.ssh目录下,也就是放这个的目录下:

ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repo_git_02


创建一个文件,config,不需要后缀名,内容为:

Host github.com
User [email protected]
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443

添加完后如下:

ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repo_github_03

G:\mylearn\source-code>ssh -T [email protected]
The authenticity of host '[ssh.github.com]:443 ([192.30.253.122]:443)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[ssh.github.com]:443,[192.30.253.122]:443' (RSA) to the list of known hosts.
Hi lightClouds917! You've successfully authenticated, but GitHub does not provide shell access.

G:\mylearn\source-code>ssh -T [email protected]
Hi lightClouds917! You've successfully authenticated, but GitHub does not provide shell access.

G:\mylearn\source-code>git pull
Warning: Permanently added the RSA host key for IP address '[192.30.253.123]:443' to the list of known hosts.
Already up-to-date.

G:\mylearn\source-code>git pull
Already up-to-date.

搞定!


标签:mylearn,code,remote,22,github,source,git,ssh
From: https://blog.51cto.com/u_15936016/6006760

相关文章