gitbook与github集成使用

Reference

1 安装node.js

2 Gitbook安装

  1. 打开cmd,运行以下命令

    bash 复制代码
    npm install -g gitbook-cli
    bash 复制代码
    gitbook install

3 新建书籍

  1. 新建一个文件,例如 gitbook_test,进入文件夹,打开cmd,运行以下命令

    bash 复制代码
    gitbook init

4 修改书籍

5 打包静态网站

bash 复制代码
	gitbook serve
  • 这个命令生成静态网站,点击输出的网址即可查看网址
  • 你会发现,在你编辑的gitbook项目的目录中会多一个 _book 目录,而这个目录中就是生成的本地预览的静态网站内容。
bash 复制代码
	gitbook build
  • 这个命令打包静态网站到文件夹 _book

6 使用github部署静态网页

参考:

  1. 在github上面新建一个仓库

    • 建立的仓库命名规则为 <你的github用户名>.github.io
  2. 进入 _book 文件夹, 打开 git bash ,运行以下命令

    bash 复制代码
    git init
    bash 复制代码
    git remote add origin https://github.com/zp1008611/zp1008611.github.io.git
    bash 复制代码
    git branch -M main
    bash 复制代码
    git add .
    bash 复制代码
    git commit -m "Initial commit"
    bash 复制代码
    git push -u origin main
  3. 进入 setting ,点击 page ,修改分支,点击 save

  4. 打开网址 https://<你的github用户名>.github.io.

相关推荐
m0_6948455711 小时前
tinylisp 是什么?超轻量 Lisp 解释器编译与运行教程
服务器·开发语言·云计算·github·lisp
June`11 小时前
muduo项目排查错误+测试
linux·c++·github·muduo网络库
weixin_66814 小时前
GitHub 2026年AI项目详细数据汇总表-AI分析-分享
人工智能·github
CoderJia程序员甲1 天前
GitHub 热榜项目 - 日榜(2026-02-05)
ai·开源·大模型·github·ai教程
weixin_6681 天前
GitHub 2026年AI项目热度分析报告-AI分析-分享
人工智能·github
MicrosoftReactor1 天前
技术速递|GitHub Copilot CLI 斜杠命令速查表
github·copilot·cli
wu~9701 天前
GitHub永不遗忘,使用git push -f来覆盖的提交依旧保留
git·github
m0_694845571 天前
music-website 是什么?前后端分离音乐网站部署实战
linux·运维·服务器·云计算·github
独自破碎E1 天前
已经 Push 到远程的提交,如何修改 Commit 信息?
开发语言·github
jiang_changsheng2 天前
工作流agent汇总分析 2
java·人工智能·git·python·机器学习·github·语音识别