没法登录github官网的解决办法

前言

今天向博客提交文章的时候,出现了以下的错误,大概的意思就是请确认你是否有权限访问这个仓库,刚开始觉得是个人hexo出现了错误,一顿hexo --debug后也没有发现什么异常,后来我就想着查看一下个人github,而后发现没法访问,因而就定位到缘由了,没法访问仓库地址。html

ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Error: Spawn failed
    at ChildProcess.<anonymous> (D:\work\hexo\node_modules\hexo-util\lib\spawn.js:52:19)
    at ChildProcess.emit (events.js:189:13)
    at ChildProcess.cp.emit (D:\work\hexo\node_modules\cross-spawn\lib\enoent.js:40:29)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)

解决办法

修改host文件java

Windows 系统位于 C:\Windows\System32\drivers\etc\ 
Android(安卓)系统hosts位于 /etc/ 
Mac(苹果电脑)系统hosts位于 /etc/ 
iPhone(iOS)系统hosts位于 /etc/ 
Linux系统hosts位于 /etc/
绝大多数Unix系统都是在 /etc/

连接:https://www.zhihu.com/question/20732532/answer/253922215

1.打开Dns检测|Dns查询 - 站长工具: http://tool.chinaz.com/dns?type=1&host=github.com&ip=node

2.在检测输入栏中输入http://github.com官网git

3.把检测列表里的TTL值最小的IP输入到hosts里,并对应写上github官网域名
imagegithub

4.接下来就一个一个试吧,总有一个有用的,目前我如今用的是这个,亲测可用web

//把这行代码添加到hosts文件内
192.30.253.112 github.com