【Hexo】使用hexo d无法上传问题解决办法

问题1

在使用hexo d上传时,可能出现以下错误

1
ERROR Deployer not found:git

解决办法

1.在博客目录下安装hexo-deployer-git

1
npm install hexo-deployer-git --save

2.在博客目录下的_config.yml文件中

1
2
3
4
deploy:
type: git
repository: https://github.com/fengrenxiaoli/fengrenxiaoli.github.io.git
branch: master

type使用git,冒号后面需要一个半角空格

问题2

使用hexo d中,出现:

1
2
3
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for 'https://github.com': No error

解决办法

1.不要使用Cygwin等cmd工具,使用自带的cmd工具(具体可以参考https://github.com/atom/atom/issues/8984

2.使用ssh(具体格式在github中有)代替_config.yml文件中的deploy

如果出现

1
INFO Deploy done: git

则说明上传成功