士不可以不弘毅 任重而道远
- 安装gitbook
- 运行
gitbook install
- build
gitbook build
- 本地运行
gitbook serve
- 目前直接通过git上传到服务端
1、在服务端创建git仓库
$ cd /var/repo
$ git init --bare gitbookBlog.git
$ ls
gitbookBlog.git hexoBlog.git
2、设置post-receive钩子
$ cd gitbookBlog.git
$ cd hooks
$ touch post-receive
$ vi post-receive
# 根据服务路径自行配置
# git --work-tree=/var/www/html/myGitbook --git-dir=/var/repo/gitbookBlog.git checkout -f
$ chmod +x post-receive
3、配置本地的gitbook的git config,增加remote
# 测试加在第一个,source tree不受影响,source tree读取的是最后一个url,但是同时都会上传
[remote "origin"]
url = root@1.2.3.4:/var/repo/gitbookBlog
url = git@github.com:lifeasy/mybook.git
fetch = +refs/heads/*:refs/remotes/origin/*