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.

相关推荐
通义灵码7 小时前
Qoder 支持通过 DeepLink 添加 MCP Server
人工智能·github·mcp
数据大魔方11 小时前
【期货量化实战】跨期套利策略:价差交易完整指南(TqSdk源码详解)
数据库·python·算法·github·程序员创富
数据大魔方12 小时前
【期货量化实战】螺纹钢量化交易指南:品种特性与策略实战(TqSdk完整方案)
python·算法·github·程序员创富·期货程序化·期货量化·交易策略实战
Cx330❀14 小时前
Git 多人协作全攻略:从入门到高效协同
大数据·elasticsearch·搜索引擎·gitee·github·全文检索·gitcode
CoderJia程序员甲16 小时前
GitHub 热榜项目 - 日榜(2026-1-9)
开源·大模型·llm·github·ai教程
lpfasd12320 小时前
系统、详细地介绍 GitHub 官方 API 的能力边界
github
KevinShi_BJ20 小时前
Github Copilot 实践
github·copilot
秋雨雁南飞21 小时前
图床软件 PicGo + Github
github·picgo·图床
moment&forever21 小时前
GitHub 托管 API 地址配置文件:实现零成本云配置托管
github
小龙1 天前
【Git 报错解决】本地无有效提交无法推送(`src refspec main does not match any`)
git·github·报错