How to Store Hexo Source and Theme on Github

When you have the ability to use hexo, you may be wonder what should we do if my device lost or
broken, how to store and transfer my source of hexo, now you need follow below these steps:

  1. init git and create branch from your blog repository

    1
    2
    3
    cd Hexo 
    git init
    git branch source
  2. edit .gitignore and add hexo source

    1
    2
    3
    4
    git  status
    git add * or git add .
    git add .gitignore
    git commit -m "add source"
  3. add themes/minos
    if you wants to add themes/minos source,it failed, you will see:

    1
    fatal: Pathspec 'xxxx' is in submodule 'themes/minos'

    because .git dir exist in themes/minos, you should do this:

    1
    2
    git rm --cached themes/minos/
    git add themes/minos/
  4. push branch

    1
    2
    3
    git branch -a
    git remote add origin https://github.com/geoxing/geoxing.github.io.git
    git push --set-upstream origin source
  5. first store over

  6. update when source changed

    1
    2
    3
    git status
    git add source/_posts/how-to-store-hexo-source-and-theme-on-github.md
    git push -u origin source
  7. enjoy