首页 GitHub提交代码报port22错误
文章
取消

GitHub提交代码报port22错误

问题

Git克隆提交出现 ssh connect to host github.com port 22 Operation timed out

ssh协议 从GitHub克隆自己的代码时,报错如下:

1
2
3
4
5
6
Cloning into 'retrofit2-gson-convert'...
ssh_dispatch_run_fatal: Connection to 52.74.223.119 port 22: Operation timed out
fatal: Could not read from remote repository.

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

解决方案

.ssh目录下新建config文本,输入如下内容:

1
2
3
4
5
6
Host github.com
User YourEmail@163.com
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443

:wq保存退出即可

实际上,在这一步时已经解决本人的问题了

如果还不能使用,重试设置config

1
2
$ git config --global user.name "XXX"
$ git config --global user.email XXX@xx.com
本文由作者按照 CC BY 4.0 进行授权