美文网首页
hexo -d提交报错问题解决

hexo -d提交报错问题解决

作者: OnyWang | 来源:发表于2018-02-26 17:18 被阅读1241次

    写完一遍博客以后,照例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下面的配置文件都是无效的,都会被覆盖。

    相关文章

      网友评论

          本文标题:hexo -d提交报错问题解决

          本文链接:https://www.haomeiwen.com/subject/nbiyxftx.html