美文网首页
保存Hexo博客源码到Github上

保存Hexo博客源码到Github上

作者: jiaomeichen | 来源:发表于2017-12-14 22:53 被阅读0次

    建立分支

    因为master分支是存放Hexo博客生成的页面,所以只能创建一个分支来保存博客的源代码在你的Github上。比如,创建一个分支叫save


    更改默认分支

    更改我们的项目默认分支为save


    clone项目

    clone你的项目到你的Hexo目录下。例如我的是执行下面的命令:

    git clone https://github.com/JiaoMeichen/JiaoMeichen.github.io.git
    

    执行命令

    执行下面的命令将你的博客的原文配置等等保存到分支save上

    git remote add origin https://github.com/JiaoMeichen/JiaoMeichen.github.io.git
    git add .
    git commit -m "your description"
    git push origin save
    

    配置

    确认你的_config.yml配置是提交到master分支

    deploy:
        type: git
        repository: git@github.com:JiaoMeichen/JiaoMeichen .github.io.git
        branch: master
    

    通过以上的配置,就可以把Hexo博客的源文件配置等保存到github上

    原理说明

    此时,hexo生成的静态博客文件默认放在master分支上。
    hexo的源文件放在save分支上,换电脑时直接git clone save

    相关文章

      网友评论

          本文标题:保存Hexo博客源码到Github上

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