hexo deplay出错,没有反应
今天想在自己的另一个博客地址(链接地址)上更新一下博客,没想到hexo deplay没有反应,以下是解决过程:(更新于 2016-12-24 11:17:43)
1、因为没有报错信息,所以直接在网上搜解决方案,集广大网友们的智慧,然后使用了npm install hexo-deployer-git –save,而后hexo deploy,但是没有解决问题,而且爆出警告:
2、更新npm npm install npm -g ,更新成功
3、继续npm install hexo-deployer-git –save,hexo deploy 还是不行:
4、后来灵机一动,把.deploy_git文件夹手动删除了,重新hexo deploy了一次,成功!
问题描述:
如题,hexo最后一次部署是在8月份,然后就是秋招,一直没有在hexo博客上上传新博文,等回过头打算整理几篇博客上传,发现一直部署失败,通过搜索网上前辈们的经验,我决定重新使用hexo+github pages搭建博客(顺便更新版本了),然而······并没有什么卵用······
错误依旧如下(这已经是重复设置SSH key后的错误版本啦,与一开始的错误描述略有不同,不过都是github权限问题):
之前的错误,有网友们有建议将deploy处设置不要使用https,而是改为SSH,如下:
|
|
修改为
|
|
修改了很多遍,以各种姿势······然而还是没有什么卵用
当然错误不是重点,重点是怎样使我们的博客可以重新部署到github上~
当部署失败的时候,请按照以下步骤进行:
(当然,在此之前,你可以选择 hexo init)教程有很多,一搜就可以,懒癌症可以点击传送门,这是一个比较全的搭建配置教程。
(1)检查是否有SSH key
登陆github,点击头像位置处 Settings ——> SSH and GPG keys ,查看是否有SSH keys。如果有,直接跳到第(2)步;如果没有,则继续。
(2)新建 SSH key,在git shell(或者git bash等命令窗口),注意大小写:
|
|
然后会出现:
直接回车就可以。
然后会出现:
|
|
要求你输入密码,这个密码会在你提交项目时使用,如果为空的话提交项目时则不用输入。这个设置是防止别人往你的项目里提交内容。
注意:输入密码的时候没有*字样的,直接输入就好。
然后会出现:
|
|
至此,密钥已经成功生成。
(3)接下来在github上添加SSH key:
① 打开本地文件:id_rsa.pub(文件路径可以在上一步SSH生成成功后看到路径,比如我的是c/Users/dell/.ssh/id_rsa.pub),可以将这个文件在编辑器中打开,然后全选复制。
② 登陆github,点击头像位置处 Settings ——> SSH and GPG keys ——> New SSH key,点击新建SSH key。
③ 将 ① 中复制的内容粘贴在key文本框里,title可以不用填(或者自己起一个名字也可以)。
(4)测试设置是否成功:
|
|
有可能会出现:
|
|
或者是
|
|
这种情况下,直接 yes 回车
然后会出现(也可能在 ++$ ssh -T git@github.com++ 之后,直接出现的就是这个,我就是这样~):
|
|
(5)设置用户信息:
|
|
(6)然后就可以部署你的博客到github啦~
|
|
(7)更多常见hexo命令,传送门
补充1:过程中也遇到一些其他问题,比如Error: Bad file number,但是总的来说,按照上面的步骤就可以解决因为github权限问题hexo部署失败的问题(前提是你的配置文件的内容没有问题)。
补充2:windows系统不要使用它自己的命令窗口!!!使用git shell或者 git bash 等之类的一些工具。