NavigationProfile
Social Media

GitBook Tutorial: Git Sync

Related AI

GitBook-AI

In this video

Introducing GitSync: Seamlessly Sync Your GitBook AI with GitHub or GitLab

Welcome to GitBook AI! In this article, we will explore one of our most powerful features, GitSync. GitSync enables you to effortlessly connect any repository hosted on GitHub or GitLab with your GitBook AI spaces. With GitSync, any changes you make in GitBook AI will be merged into your remote repository, and any updates you make in your repository will be automatically reflected in GitBook AI. This comprehensive guide will walk you through the setup process and highlight configuration options to seamlessly integrate GitBook AI into your existing workflows.

Setting Up GitSync with Your GitBook AI Space

Before we begin, make sure you have a GitBook AI space set up. If you don't have one yet, you can easily create a new space by heading to the lower left-hand corner of your GitBook AI interface and clicking on «Create a New Space.» Once you have your space ready, follow these steps to set up GitSync:

Step 1: Access GitSync Configuration

To begin the GitSync setup process, access the GitSync configuration panel. You can do this either by clicking on the tray at the bottom of your document or through the menu icon located in the upper right corner of your GitBook AI interface.

Step 2: Authenticate Your Account

To sync your GitBook AI space with a repository, you need to authenticate your user account with either GitHub or GitLab, depending on your preferred service. In this guide, we will focus on GitHub. After clicking the menu icon mentioned in the previous step, select «Synchronize with Git» from the options. Choose your preferred provider and proceed to authenticate your account by signing in. Note that if you're using GitHub for the first time, you might be prompted to add the GitBook AI app to your GitHub account. This step is essential to complete the GitHub setup successfully.

Step 3: Select Account and Repository

Once you've authenticated your account, you can choose the account and repository you want to sync. If you're syncing a private repository, make sure to configure your provider settings to grant access. Additionally, you have the option to select a specific branch for synchronization if you only want to sync a particular version of your GitBook AI with your repository.

Step 4: Customize Your Integration

GitSync offers additional options for customization to tailor the integration according to your preferences:

Monorepo Configuration

The Monorepo section allows you to specify a directory within your repository that GitBook AI will read from. By default, GitBook AI syncs your repository at the root level. However, by adding a specific directory in this section, you can ensure that GitBook AI only works with the desired files. This feature is especially useful if you have multiple product documentation within a single repository, enabling you to create separate GitBook AI spaces for each product.

Custom Commit Messages

In GitSync, you can customize the commit messages displayed when making changes in GitBook AI. For detailed instructions on customizing commit messages, please refer to our documentation.

Step 5: Select Initial Sync Content

GitSync facilitates bi-directional synchronization, meaning that content changes are synced on both sides, whether you make edits in your repository or GitBook AI. However, for the initial sync, you need to choose the content source. If your content already exists on GitHub or GitLab, select the first option to import that content into GitBook AI. On the other hand, if you have already written content in GitBook AI and wish to use it as the source, choose the second option. Note that selecting either option will overwrite the content in the other space.

Step 6: Synchronize and Finalize Setup

Once you have configured all the settings, click the «Synchronize» button to complete the setup process. Please be aware that if your repository contains a significant amount of content or numerous images, the initial setup may take some time. It's important to note that the chosen configuration options cannot be modified once the setup is completed. However, if you need to update your configuration, you can remove and re-initialize GitSync.

Syncing Changes: Making Edits in GitBook AI and the Repository

With GitSync set up, let's explore how changes and edits are synchronized between GitBook AI and your repository:

Making Changes in the Repository

To make changes in your repository, you can follow the typical workflow of creating a pull request. This approach allows you to suggest and propose changes to your content, facilitating reviews, feedback, and collaboration with others involved in the process. After creating a pull request, you will notice an automatic check running, indicating that the GitBook app is generating a preview link in the background. This preview link allows you to view your changes in the context of the rest of your content. Please note that preview links are currently supported only in our GitHub integration. If you don't see this option, ensure that you have installed the GitBook app in your GitHub account. Once you are satisfied with the changes, you can merge the pull request, and your GitBook AI space will reflect the updates.

Making Changes in GitBook AI

Editing content in GitBook AI is a straightforward process that enables you to suggest changes to your content through change requests. When you merge a change request into the main content, GitSync ensures that the changes are synced to your provider and added to the repository through a commit.

Customization Options: Adding a GitBook.yaml File

For further customization, you can add a gitbook.yaml file to the root of your project. This file allows you to specify various settings, such as the structure of your GitBook and any redirects you want to include throughout your documentation. Refer to our product documentation for detailed information on utilizing the gitbook.yaml file.

Conclusion

GitSync empowers you to work seamlessly with your existing content in GitBook AI and enhances collaboration within your team by utilizing the tools you already know and love. Whether you're making changes in GitBook AI or your repository, GitSync ensures that your content remains synchronized. To learn more about GitBook AI and engage with our community, visit our GitHub Community page. Thank you for choosing GitBook AI, and we look forward to supporting your documentation needs.

Tags

GitBook-AI

We Use Cookies to Enhance Your Experience

Our website uses cookies to provide you with a personalized experience and to improve our website. By clicking 'Accept', you consent to our use of cookies. To learn more about how we use cookies and your options, please see our Cookie Policy page.

Accept