hexo更新博客到coding和github

新建博客

hexo new "blog_name"

会在post下生成文件,在文件中添加博客内容

生成静态文件

hexo generate

或者

hexo g

本地预览

hexo server 

或者

hexo s

在本地htpp://localhost:4000 可以预览

部署到git

hexo deploy 

或者

hexo d

部署到到指定git地址上,git地址在根目录的_config.yml文件中设置
如:

coding.net:

# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
  type: git
  repository: https://git.coding.net/vence/vence.git
  branch: master

github:

deploy:
  type: git
  repository:  https://github.com/Vence/Vence.github.io.git
  branch: master

不知道这里是否可以同时设置多个deploy地址,这样可以一键部署到多个git地址上,这个我还在摸索中。

也可以同时设置多个git地址:
如下:

# Deployment
## Docs: http://hexo.io/docs/deployment.html
deploy:
  type: git
  repo: 
    github:  https://github.com/Vence/Vence.github.io.git
    coding: https://git.coding.net/vence/vence.git
  branch: master

备份源码

git add *
git commit -m 'add files'
git remote add origin https://git.coding.net/vence/blogcodesource.git
git push -u origin master

将博客源码同步提交到指定的git仓库中备份,这样可以异地对hexo博客进行修改

如果换一代电脑,首先要

git clonehttps://git.coding.net/vence/blogcodesource.git

从仓库中拉取博客源码到本地后再修改

本站总访问量