记录使用Hexo时遇到的问题
问题一:解决 ssh: connect to host github.com port 22: Connection timed out
-
问题
在使用
hexo d向GitHub上传代码时,出现错误(此前已经使用SSH的方式连接了GitHub仓库并且hexo d没问题)1
2
3ssh: connect to host github.com port 22: Connection timed out
Please make sure you have the correct access rights
and the repository exists.首先输入以下命令检查
SSH是否能够连接成功(ssh后面有空格)1
ssh -T [email protected] (或者ssh -vT [email protected],即显示详细信息)
发现报错
1
ssh: connect to host github.com port 22: Connection timed out
再使用下方命令,若成功,则使用下面的解决方法
1
ssh -T -p 443 [email protected]
-
解决方案
在C盘——用户——找到.ssh文件夹;(此前配置SSH时会生成该文件夹)
在.ssh文件夹中新建文件config,不带后缀(可以新建文本文档,去掉.txt后缀)
使用ndd–(或其他方式)打开config文件,输入以下内容,保存后即可1
2
3
4
5
6Host github.com
User YourEmail(填你github注册邮箱)
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443会出现提示后 ,输入yes回车即可,然后再次执行
ssh -T [email protected],发现验证通过1
Hi xxx! You've successfully authenticated, but GitHub does not provide shell access.
-
参考:
其他
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 ZのBlog!
评论
