0%

github port 22 not working

github port 22 not working

今天在使用github的时候,发现git push的时候报错:

1
2
3
4
5
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.

解决办法,使用443端口,首先测试是否可用。

1
ssh -T -p 443 git@ssh.github.com

如果可以正常连接,那么就可以修改~/.ssh/config文件,添加如下内容:

1
2
3
Host github.com
Hostname ssh.github.com
Port 443

然后再次测试:

1
ssh -T git@github.com

输出如下信息:

1
Hi Philip! You've successfully authenticated, but GitHub does not provide shell access.

接下来就可以愉快的使用git了。

Reference