Git克隆提交出现“ssh: connect to host github.com port 22: Operation timed out fatal”问题

没有一点点防备,也没有一丝顾虑,
你就这样出现,在我的世界里,
带给我惊喜,情不自己

问题

克隆,提交代码是出现问题:

分析:输出信息prot 22: Operation timed out,初步分析端口问题我们修改端口试试,这里将端口改为443

解决方法

在存放私钥公钥(id_rsa和id_rsa.pub)文件里,新建config文本。命令vim ~/.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

这个操作就是为了刷新config,使修改生效。