写完一遍博客以后,照例hexo -g hexo -d生成和提交。但是在成功生成之后,进行提交的时候报错了!
nothing to commit, working directory clean
bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for '[GitHub · Where software is built](https://link.zhihu.com/?target=https%3A//github.com)': No error
FATAL Something's wrong. Maybe you can find the solution here: [Troubleshooting](https://link.zhihu.com/?target=http%3A//hexo.io/docs/troubleshooting.html)
Error: bash: /dev/tty: No such device or address
error: failed to execute prompt script (exit code 1)
fatal: could not read Username for '[GitHub · Where software is built](https://link.zhihu.com/?target=https%3A//github.com)': No error
at ChildProcess.<anonymous> (E:\SwuComputer\HTML5\hexo\node_modules\hexo-deployer-git\node_modules\hexo-util\lib\spawn.js:42:17)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:818:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
关注主要的报错信息:
fatal: could not read Username for '[GitHub · Where
按照以下步骤进行操作,解决了以上问题:
修改配置文件:根目录下的_config.yml,修改deploy节点。
原来的配置为:
deploy:
type: git
repo: https://github.com/{yourname}/{yourname}.github.io.git
branch: master
修改为如下:
deploy:
type: git
repo: https://{yourname}:{yourpassword}@github.com/{yourname}/{yourname}.github.io.git
branch: master
亲测可行。
原因分析:
如果在使用hexo d命令的前提下,直接修改.git下面的config文件是无法成功的。原因是:使用该命令之后,会根据_config.yml下面的deploy节点进行cofig文件的覆盖。也就是说,_config.yml如果不做修改,无论如何修改.git下面的配置文件都是无效的,都会被覆盖。
网友评论