git连接GitHub的超时问题

在进行GitHub的连接测试,以及进行git pull 的时候,出现报错

ssh: connect to host github.com port 22: Connection timed out

原因是ssh 阻塞了22端口,可以通过修改配置文件,不走22端口,改走其他端口,就能解决这个问题。

一种是在用户主目录下.ssh/中添加配置文件。

cd ~/.ssh/
touch config

写入下列内容:

 

Host github.com  
User git  
Hostname ssh.github.com 
PreferredAuthentications publickey  
IdentityFile ~/.ssh/id_rsa 
Port 443

这时候再次进行push或者连接测试就能正常运行了。

你可能感兴趣的:(git,github)