Ria Choi
← Blog

GitBook for documentation

Tutorial on how to sync your repository with GitBook

GitBook for documentation

Documentation Is Hard Work

Blog image

I used to write every document in Notion by hand.

Then I noticed something. If coding is 70% of my work, documenting is the other 30%.

That is a big share of team collaboration. Docs matter a lot. But they are also painful to write and maintain.

So I started looking for a way to automate it.

Why GitBook?

While Confluence, Jira and Notion are great tools and they work well for planners and designers, for developers, GitBook can be a better fit. Here is why.

  • Your docs live in Git, right next to your code.
  • You write in Markdown, which developers already know.
  • Changes go through reviews, just like code.
  • An AI agent can read and write the files directly.

GitBook is open to everyone. Anyone can sign up and try it.

I activated the 13 day free trial, and you can do the same.

Blog image

What Is GitBook Good For?

GitBook turns your Markdown files into a clean documentation site.

It works well for:

  • API documentation
  • Internal team wikis
  • Onboarding guides
  • Product manuals
  • Project handover notes
Blog image

Part 1: Sign Up for GitBook

Getting started takes only a few minutes.

  1. Go to the GitBook website.
  2. Click Sign up.
  3. Sign in with your email, Google, or GitHub account.
  4. Create your organization.

Tip: Signing in with GitHub makes the later Git Sync step easier.

 

Part 2: Create Your First Space

A Space is one documentation project in GitBook.

  1. Click New space.
  2. Choose a name for your space.
  3. Pick a template, or start with a blank space.
Blog image

Part 3: Connect Git Sync

This is the key step. Git Sync connects your GitBook space to a Git repository.

After this, your docs and your code live in the same place.

  1. Open your space.
  2. Click the Git Sync option in the space settings.
  3. Choose GitHub or GitLab.
  4. Authorize GitBook to access your account.
  5. Select the repository and the branch.
  6. Choose the sync direction.

Here are two ways to start.

  • GitHub to GitBook: Your repository is the source. Good if you already have Markdown files.
  • GitBook to GitHub: GitBook is the source. Good if you are starting from scratch.

Once connected, every change is synced between both sides.

Blog image

Part 4: Ask an AI Agent to Build Your GitBook

Now comes the fun part.

Instead of writing docs by hand, let an AI agent do the work.

Open your repository with an AI coding agent. Then give it a clear request.

Here is a sample prompt:

Read this project and create documentation in Markdown. Include an overview, setup guide, API reference, and FAQ. Organize the files so they work with GitBook.

The agent reads your code. It then creates the Markdown files and the page structure.

GitBook uses a few simple files to organize your pages.

  • SUMMARY.md controls the table of contents.
  • .gitbook.yaml sets the root folder for your docs.

Commit and push the changes. Git Sync will bring them into GitBook.

You can also feed your agent this link that leads to a page where they explain how to configure the content.

https://gitbook.com/docs/docs-as-code/git-sync/content-configuration?utm_source=chatgpt.com

Blog image
Asking Chat GPT to add gitbook-docs.yaml on main
Blog image
Content configuration page

Tip: Review what the agent writes. AI is fast, but you know your project best.

Part 5: Publish Your Site

Your docs are now in GitBook. Time to share them.

  1. Open your space.
  2. Click Publish.
  3. Choose who can see it. You can make it public or limit access.
  4. Copy your site link.
  5. Optional: add a custom domain.

That is it. You now have a live documentation site.

Blog image
Blog image

The New Workflow

Here is the full flow in one view.

  1. Write code.
  2. Ask the AI agent to update the docs.
  3. Review the changes.
  4. Push to Git.
  5. GitBook syncs and publishes.

Docs now follow your code. You no longer need to write everything by hand.

Final Thoughts

Documentation will always matter. But it does not have to eat your time.

GitBook gives developers a home for docs that fits their workflow. An AI agent handles the heavy writing. You focus on the code and the review.

If you want to try it, start the free trial and connect your first repository. You may be surprised how much time you save.

Related Posts

View all