git ssh 出现 connect to host github.com port 22:Connection timed out
使用git 的时候,提示如下错误:connect to host github.com port 22: Connection timed out
解决方法
输入这个命令等待结果:
ssh -T git@github.com
结果如果是 “ssh: connect to host github.com port 22: Connection timed out”
打开存放ssh的目录
cd ~/.ssh ls
或者 直接去 c盘 里边找
查看是否存在 id_rsa id_rsa.pun known_hosts 三个文件,如果没有就需要先配置好用户名和邮箱然后使用
ssh-keygen -t rsa -C “你刚才设置过得邮箱” 生成git ssh key 配置到服务端如果存在,则新建config文件输入下面内容
Host github.com User YourEmail@163.com Hostname ssh.github.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa Port 443
再次执行”ssh -T git@github.com“ 一遍,会出现如下提示,回车”yes”即可
至此就可以正常用了。