今天想在自己的另一个博客地址上更新一下博客,没想到hexo deplay
没有反应,以下是解决过程:
- 当部署失败(报错内容如图所示)的时候,请按照以下步骤进行:
通过SSH key来上传代码
1、将SSH key添加到github中
① 打开本地文件:id_rsa.pub
(文件路径可以在上一步SSH生成成功后看到路径,比如我的是c/Users/echo/.ssh/id_rsa.pub
),可以将这个文件在编辑器中打开,然后全选复制。
② 登陆github
,点击头像位置处 Settings ——> SSH and GPG keys ——> New SSH key
,点击新建SSH key
。
③ 将 ① 中复制的内容粘贴在key文本框里,title可以不用填(或者自己起一个名字也可以)
2、测试设置是否成功:
1 | $ ssh -T git@github.com |
如果出现如下情况1
2Hi username! You've successfully authenticated, but GitHub does not
provide shell access.
将项目中如下位置文件做出更改
不要使用https,而是改为SSH,如下:1
repository: https://github.com/username/username.github.io.git
修改为1
repo:git@github.com:username/username.github.io.git
一般这步基本就可以部署了!!!
如果部署还是失败,可以试试如下步骤(还是不行,就多试几遍。。。有点坑)1
2
3
4$ sudo rm -rf .deploy_git
$ hexo clean
$ hexo g
$ hexo d
本人的问题成功解决了,希望帮到大家哈哈哈哈哈开心!
3、部署Hexo踩过的坑:
hexo d -g
出现的问题:
如果出现如下情况1
2
3
4
5
6
7
8INFO Deploying: git
INFO Clearing .deploy_git folder...
INFO Copying files from public folder...
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
TypeError [ERR_INVALID_ARG_TYPE]: The "mode" argument must be integer. Received an instance of Object
at copyFile (node:fs:2049:10)
at tryCatcher (/Users/admin/othproject/blogs/blog/node_modules/bluebird/js/release/util.js:16:23)
at ret (eval at makeNodePromisifiedEval (/usr/local/lib/node_modules/hexo/node_modules/bluebird/js/release/promisify.js:184:12), <anonymous>:13:39)
出现这些是因为node版本太高,切换成低版本的node来安装Hexo就可以了.
hexo d
出现权限问题
执行此步骤:1
2
3
4
5
6
7
8$ sudo rm -rf .deploy_git
$ ls -all
// 查看是否还有.deploy_git文件
$ hexo clean
$ hexo g
$ hexo d
// 或者
$ sudo hexo d
依然报错-继续执行此步骤:可能原因
:key不是在root账户生成的原因1
2
3
4
5
6
7
$ sudo ssh-keygen -t rsa -C “idealife@github.com”
// 对应路径为/var/root/.ssh
$ sudo cat /var/root/.ssh/id_rsa.pub
$ sudo hexo deploy
结束语
总结:大功告成✌️✌️✌️✌️✌️✌️✌️✌️✌️✌️✌️✌️✌️✌️✌️✌️✌️✌️✌️✌️
其他的坑🉑️参考:部署Hexo踩过的坑—node14.0配置hexo