在等待git pull命令超时之后报出了类似: ssh: connect to host github.com port 22: Connection timed out的错误!

原因: ssh 阻塞了22端口

解决方法: 修改 ssh 的配置文件

  • Linux/Mac OS: 在用户主目录下 ~/.ssh/ 中添加配置文件 config
  • Windows: 在 C://Users/<Your username>/.ssh 中添加配置文件 config

文件内容:

# 在config中添加下面内容
Host github.com  
User git  
Hostname ssh.github.com 
PreferredAuthentications publickey  
IdentityFile ~/.ssh/id_rsa 
Port 443