[VuePress]个人博客 -- 批处理自动化编译提交 -- 排错记录

建了一个VuePress个人博客
想着写个批处理,自动编译并上传到GitHub。
结果遇到两个问题,

  • 一个是,vuepress build docs编译后,这个命令执行完就exit

    研究了下bat,发现只有分成多个批处理写,通过call <other-bat-file>的方式可以解决

  • 一个就是上传失败

    error: src refspec gh-pages does not match any.
    

    排错过程颇为曲折

    • 错误0
    F:\fcn-working\Github\03.my-repos\v-blog\docs\.vuepress\dist>git push -f origin gh-pages
    error: src refspec gh-pages does not match any.
    error: failed to push some refs to 'https://github.com/CoderMonkie/v-blog.git'
    
    • 错误1
    my-repos\v-blog\docs\.vuepress\dist>git push --set-upstream origin gh-pages
    error: src refspec gh-pages does not match any.
    error: failed to push some refs to 'https://github.com/CoderMonkie/v-blog.git'
    
    • 错误2
    my-repos\v-blog\docs\.vuepress\dist>git branch --set-upstream-to=origin/gh-pages master
    error: the requested upstream branch 'origin/gh-pages' does not exist
    hint:
    hint: If you are planning on basing your work on an upstream
    hint: branch that already exists at the remote, you may need to
    hint: run "git fetch" to retrieve it.
    hint:
    hint: If you are planning to push out a new local branch that
    hint: will track its remote counterpart, you may want to use
    hint: "git push -u" to set the upstream config as you push.
    
    • 正确操作:
    git push origin HEAD:gh-pages
    
    • 注意:

      命令行窗口终于出现要求输入username,
      直接邮箱,password输入密码,竟然不对,
      仔细看提示,好像是要让输入【用户名】,
      输入CoderMonkie,一路下去中去提交成功!


  • 终于编译并且成功pushorigin gh-pages分支上了,
    但博客网站404

    setting中,GitHubPages已经设为gh-pages

    是忘了设config.js中的base: '/v-blog/'了吧。
    设完重新发布,竟然还是 404

    搜索了以下这个问题,大概要等一段时间之后再来看
    依据:

我之前另外的GitHub Pages显示的setting:

 Your site is published at https://codermonkie.github.io/CoderPower/

新建的博客的则显示:

Your site is ready to be published at https://codermonkie.github.io/v-blog/.

很显然,差别就在这儿了

应该是可以了。等待结果。

(深夜)更新:已经好了v-blog
GitHub Pages/source的下拉框里切换了几次,不经意间发现已经发布了。

posted on 2019-11-05 17:59  CoderMonkey  阅读(222)  评论(0编辑  收藏  举报

导航