The State of Docs Report 2025 is live! Dive in and see why docs matter more than ever:
Read the report
LogoLogo
ProductPricingLog inSign up
  • Documentation
  • Developers
  • Guides
  • Changelog
  • Help Center
  • Getting Started
    • GitBook Documentation
    • Quickstart
    • Importing content
    • GitHub & GitLab Sync
      • Enabling GitHub Sync
      • Enabling GitLab Sync
      • Content configuration
      • GitHub pull request preview
      • Commit messages & Autolink
      • Monorepos
      • Troubleshooting
  • Creating Content
    • Formatting your content
      • Inline content
      • Markdown
    • Content structure
      • Spaces
      • Pages
      • Collections
    • Blocks
      • Paragraphs
      • Headings
      • Unordered lists
      • Ordered lists
      • Task lists
      • Hints
      • Quotes
      • Code blocks
      • Files
      • Images
      • Embedded URLs
      • Tables
      • Cards
      • Tabs
      • Expandable
      • Stepper
      • Drawings
      • Math & TeX
      • Page links
    • Reusable content
    • Broken links
    • Searching content
      • Search & Quick find
      • GitBook AI
    • Writing with GitBook AI
    • Version control
  • API References
    • OpenAPI
      • Add an OpenAPI specification
      • Insert API reference in your docs
    • Guides
      • Structuring your API reference
      • Adding custom code samples
      • Managing API operations
      • Describing enums
      • Integrating with CI/CD
  • Extensions reference
  • Publishing Documentation
    • Publish a docs site
      • Public publishing
      • Private publishing with share links
    • Site structure
      • Content variants
      • Site sections
    • Site customization
      • Icons, colors, and themes
      • Layout and structure
      • Extra configuration
    • Set a custom domain
    • Setting a custom subdirectory
      • Configuring a subdirectory with Cloudflare
      • Configuring a subdirectory with Vercel
    • Site settings
    • Site insights
    • Site redirects
    • Visitor authentication
      • Enabling visitor authentication
      • Setting up Auth0
      • Setting up Azure AD
      • Setting up AWS Cognito
      • Setting up Okta
      • Setting up OIDC
      • Setting up a custom backend
  • LLM-ready docs
  • Collaboration
    • Live edits
    • Change requests
    • PDF export
    • Inviting your team
    • Comments
    • Notifications
  • Integrations
    • Install and manage integrations
    • GitHub Copilot
  • Account management
    • Plans
      • Legacy pricing
      • Sponsored site plan
      • Non-profit plan
      • Billing policy
    • Subscription cancellations
    • Personal settings
    • Organization settings
    • Member management
      • Invite or remove members
      • Roles
      • Teams
      • Permissions and inheritance
    • SSO & SAML
      • SSO Members vs non-SSO
  • Resources
    • GitBook UI
    • Keyboard shortcuts
    • Glossary
Powered by GitBook
LogoLogo

Resources

  • Showcase
  • Enterprise
  • Status

Company

  • Careers
  • Blog
  • Community

Policies

  • Subprocessors
  • Terms of Service
On this page

Was this helpful?

Edit on GitHub
  1. Getting Started
  2. GitHub & GitLab Sync

Monorepos

GitBook supports monorepos. A monorepo is a repository that contains more than one logical project (e.g. an iOS client and a web application).

GitBook can synchronize multiple directories from the same repository with multiple spaces. When enabling Git Sync on a space, you can configure a "Project directory". It will be used to lookup the .gitbook.yaml file for the directory to synchronize with this space.

Example of a repository structure:

/
  package.json
  packages/
     styleguide/
        .gitbook.yaml
        README.md
        SUMMARY.md
     app/
        README.md
        SUMMARY.md
     api/
        .gitbook.yaml
        README.md
        SUMMARY.md

In this example, 3 spaces can be created on GitBook and configured with different Root directories:

  • packages/styleguide

  • packages/app

  • packages/api

Updating the Project directory

In most cases, we recommend the following step to update the Project directory:

  1. Disable the existing Git Sync

  2. Move the files in the Git repository to the Project directory

  3. Reconfigure the Git Sync with the new Project directory

In some cases, you might have started with a typical repository synchronizing with only one space, but then decided to transition into a monorepo with multiple spaces synchronizing with it; or might have to rename the Project directory.

Changing the Project directory on an existing Git Sync can have an unexpected impact on the content, the change will only be propagated during the next synchronization (edit made on GitBook or new commit in the Git repository).

If the next operation is an import from the Git repository:

GitBook will expect to find the pages and files in the Project directory. If the files have not already been moved into the repository’s Project directory, the result of the synchronization would be an empty space with no content.

We recommend having the next operation to be a commit moving all GitBook-related files (markdown files, README/SUMMARY, and assets) in the repository to their correct new location, in the Project directory.

If the next operation is an export from GitBook to the Git repository:

GitBook will generate or update new files in the new Project directory. Files synchronized with GitBook will be moved to the new Project directory (with the best attempt); it might cause side effects if other parts of your system depend on these files.

Last updated 5 months ago

Was this helpful?

The "Project directory" option at the Git Sync level differs from the in the .gitbook.yaml configuration file. The first is used to lookup .gitbook.yaml itself, then both are combined to lookup the rest of the files in the directory. If no .gitbook.yaml exists in the "Project directory", the synchronization will use the default configuration scoped to this directory.

root option