MB Story

MB Story | coder

0%

Hexo常见的坑汇总

deploy by git

配置 _config.yml的几个坑

1
2
3
4
5
6
7
8
9
# You can use this:
deploy:
type: git
repo: <repository url>
branch: [branch]
message: [message]
name: [git user]
email: [git email]

失误1

注意冒号后面有个空格啊!
注意冒号后面有个空格啊!
注意冒号后面有个空格啊!

失误2

message: [message] 参数为空,则会显示Site updated: xxx
如果deploy报错,可能就是这里填错了。能空就空,哈哈哈,懒得配。

失误3

执行命令: hexo d 报错无法识别git user name
提示: 本机git config 没有配置user.email and user.name
然后就配置全局的git如下:

1
2
3
git config --global user.email "xxx@xx.com" #github绑定的邮件
git config --global user.name "custom name" #自定义用户名就可以了

失误4

执行命令: hexo d 报错没有rsa ssh key
那么,就先查找有没有ssh key

如果提示:No such file or directory,就是木有ssh key啦。
那就生成一份ssh key
enter passphrase 就是给ssh key设置密码

生成ssh key之后,找到并打开ssh key pub 文件,复制全部内容到github设置里new ssh。
当然,也可以用命令行的方式提交到github。