大概原理是我们可以将一个github repo 里面的内容隐射到一个域名下
例如
域名:clarkchen.github.io
对应的git 项目是
静态repo:https://github.com/clarkchen/clarkchen.github.io
但是这个项目里面是纯的HTML文件,而我们日常书写的习惯是,通过Markdown来写作,所以需要找一个软件能够将我们写的Markdown的内容,自动生成 html并且上传到 对应的 静态repo 的项目距下面,我们选择的工具是 Hexo。
Hexo Deploy
https://hexo.io/zh-cn/docs/one-command-deployment.html
例如我的配置是1
2
3
4
5
6
7
8
9
10
11# Deployment
## Docs: https://hexo.io/docs/deployment.html
deploy:
type: git
repo: git@github.com:clarkchen/clarkchen.github.io.git
branch: master
name: clarkchen
email: cxfhacker@gmail.com
ignore_hidden: false # default is true
ignore_pattern: regexp # whatever file that matches the regexp will be ignored when deploying
做好这个配置之后,我们可以将markdown 对应的文件和 assests 传到另外一个 repo 上,然后编辑完成之后,通过1
hexo deploy
来完成自动的文件上传和部署