Migrate your content to GitBook with Git Sync
Easily import content from you previous documentation provider — or from GitHub or GitLab — using Git Sync in GitBook
Last updated
Easily import content from you previous documentation provider — or from GitHub or GitLab — using Git Sync in GitBook
Last updated
One of the best ways to import your content into GitBook is using . With Git Sync, you can choose to import a repository from either GitHub or GitLab, to add all your docs content to your new GitBook organization in minutes.
From your GitBook , navigate to the top right of the screen and click Set up Git Sync. This will open a modal where you can configure the GitHub integration.
Before you go any further, you’ll need to install the GitBook app on GitHub.
If you haven’t done this already, you’ll see a prompt to add the GitBook app to your GitHub account. Follow the instructions in the GitHub popover and either give GitBook-specific repository permissions, or allow access to all repositories, depending on your needs.
Next, select the GitHub repository you want to sync with your GitBook space, and choose which branch you want commits to be pushed to and synced from.
Finally, you can start your initial sync. When syncing for the first time, you’ll have the option to sync in one of two directions:
GitHub -> GitBook will sync content from your selected branch with your GitBook space. This is great if you have existing Markdown content in a repository and want to import it into GitBook.
GitBook -> GitHub will sync content from your GitBook space to the selected branch. This is great if you’re starting with an empty repository and want to get your GitBook content in quickly.
From your space, navigate to the top right of the screen and click Set up Git Sync. This will open a modal where you can configure the GitLab integration.
From here, you’ll need to enter a personal GitLab access token. You can create your access token in GitLab by navigating to Settings > Access Tokens
When configuring the tokens, you need to ensure that you enable the following access for your token:
api
read_repository
write_repository
Once you have generated the token, paste it into the text field in GitBook and click Authenticate.
Next, select the GitLab repository and branch you want to keep in sync with your GitBook content.
Finally, you can start your initial sync. When syncing for the first time, you’ll have the option to sync in one of two directions:
GitLab -> GitBook will sync content from your selected branch with your GitBook space. This is great if you have existing Markdown content in a repository and want to import it into GitBook.
GitBook -> GitLab will sync content from your GitBook space to the selected branch. This is great if you’re starting with an empty repository and want to get your GitBook content in quickly.
Once you have synced your content using Git Sync, the sync runs both ways. That means any changes you or your team make in your GitHub or GitLab repository will be reflected in GitBook, and vice versa.
→ How to find & replace or batch change with Git Sync
→ Discover more about Git Sync on our website