---
updatedAt: 2026-10-29T21:20:20.000Z
agentTools:
  siteIndex: https://docs.readme.com/llms.txt
  siteSearch: https://docs.readme.com/agentSearch?query=term1%20term2
  projectIndex: https://docs.readme.com/main/llms.txt
  projectSearch: https://docs.readme.com/main/agentSearch?query=term1%20term2
---

# Bi-Directional Sync

Connect your project to a GitHub, GitLab, or Bitbucket repository so content stays in step whether you edit in ReadMe or in your repo.

Bi-directional sync creates a two-way connection between your ReadMe project and a GitHub, GitLab, or Bitbucket repository. This optional workflow keeps content consistent across both platforms. With Bi-directional sync you can:

* Write in your preferred environment whether that’s ReadMe or your local development environment.
* Developers, engineers, and technical writers can collaborate using the tools they prefer.
* Changes sync automatically between ReadMe and Git creating a single source of truth.
* All content types sync, including guides, API reference pages, custom pages, recipes, and changelogs.

<PlanTable currentPlan="Starter" />

## Setting Up Bi-Directional Sync

ReadMe supports bi-directional sync with <Anchor target="_blank" href="https://docs.readme.com/main/docs/sync-with-github">GitHub</Anchor>, <Anchor target="_blank" href="https://docs.readme.com/main/docs/sync-with-gitlab">GitLab</Anchor>, and <Anchor target="_blank" href="https://docs.readme.com/main/docs/sync-with-bitbucket">Bitbucket Cloud</Anchor>.

For syncing with GitHub, you can connect to GitHub Cloud. If you are on the Enterprise plan, ReadMe supports bi-directional sync to <Anchor target="_blank" href="/main/enterprise/github-enterprise-sync">GitHub Enterprise Server</Anchor>.

<Image src="https://files.readme.io/4a609e72d4a1c439cddc3233bff39b4f5945f381e9d3d7c7f1d1ba325571ce73-readme-git-connection-picker-framed.png" align="center" />

<Callout icon="⚠️" theme="warn">
  ### The repository you’re syncing to must be empty—no commits or files (e.g., README.md)—before connecting to ReadMe. You can add files after setup.
</Callout>

<Callout icon="📘" theme="info">
  ### Connecting to a repository owned by an organization (e.g., a GitHub organization, GitLab group, or Bitbucket workspace) may require organization-level permissions such as the ability to install or configure third-party apps. If you encounter a permissions error during setup, coordinate with an organization owner or admin on your Git provider. See the provider-specific setup pages linked above for details.
</Callout>

## Branching with bi-directional sync

Combining bi-directional sync with [branching](https://docs.readme.com/main/docs/branches) gives you access to ReadMe's powerful collaboration system. Branches in ReadMe correlate directly to branches in your bi-directional sync repo, and your team can either use ReadMe's merging/conflict resolution system within our UI, or pull requests in your Git provider, whichever fits your team's workflow! Once a feature branch has been merged into a main branch, changes go live on your published developer hub.

### Branch Requirements `main`

Every connected repository needs a `main` branch, even if your team doesn’t use one. Versioned content syncs to branches named after your ReadMe versions, but unversioned content like [Changelog](https://docs.readme.com/main/docs/changelog) entries syncs to `main`. Keep `main` in your repository, and make sure [branch protection](#push-rejected-the-target-branch-is-protected) isn’t blocking ReadMe Sync from pushing to it.

## Editing Your Docs

<Callout icon="📘" theme="info">
  ### Use the ReadMe cli tool when editing your repo

  It's easy to make mistakes when editing your repo directly, that's why we created [a cli tool ](https://docs.readme.com/main/docs/cli)you can use to make sure everything is consistent before pushing content. The cli tool is also necessary any time you sync OpenAPI specification files
</Callout>

Once your Git Connection is set up, all changes made in the ReadMe editor will automatically sync to your Git repository, and vice versa. When editing documentation in Git, you can use your preferred code editor or Git tools.

To ensure successful syncing from *Git to ReadMe*, follow these structure guidelines:

**Markdown Files:**

* Files must include required frontmatter: `title` and `summary`
* Content should be written in standard Markdown format
* File names must match the intended URL slug for proper routing

**Navigation:**

* Page order is defined using `_order.yaml` files
* Each category folder can have its’ own `order.yaml`
* [Navigation structure](https://docs.readme.com/main/docs/documentation-structure#/) in Git mirrors your ReadMe project hierarchy

[Branches](https://docs.readme.com/main/docs/branches#/)

* The initial commit from ReadMe is to establish branch synchronization with GitHub
* Branch names must exactly match the version names defined in ReadMe
* Any mismatched version and names will exist in GitHub and will not sync with ReadMe.

<br />

<HTMLBlock>{`
<div class="migrating-column">
  <section>
    <header>
      <i class="fa-duotone fa-solid fa-hexagon-exclamation"></i> Unsynced
    </header>
    <pre>ReadMe: v2.0_new-branch
GitHub: v2-new-branch
		</pre>
  </section>
  <section>
    <header>
      <i class="fa-duotone fa-solid fa-circle-check"></i> Synced
    </header>
    <pre>ReadMe: v2.0_new-branch
GitHub: v2.0_new-branch
		</pre>
  </section>
</div>
`}</HTMLBlock>

<HTMLBlock>{`

<style>
  .migrating-column {
    border: 1px solid var(--color-border-default);
    border-radius: var(--border-radius);
    display: flex;
    justify-content: center;
    
    + .migrating-column {
      margin-top: 1em;
    }
    
    section {
      flex: 1 1 50%;
      overflow: hidden;
      
      + section {
        border-left: 1px solid var(--color-border-default);
      }
    }
    
    pre {
      background: transparent;
      border: 0;
      border-radius: 0;
      font-size: 0.8em;
      margin: 0;
      overflow: auto;
      padding: 15px;
      
      + pre {
        border-top: 1px solid var(--color-border-default);
      }
    }
    
    header {
      align-items: center;
      border-bottom: 1px solid var(--color-border-default);
      display: flex;
      font-size: 15px;
      font-weight: var(--font-weight-bold);
      gap: 0.5em;
      padding: 1em;
    }

    .fa-circle-check {
      color: var(--green);
    }

    .fa-hexagon-exclamation {
      color: var(--red);
    }
  }
</style>
`}</HTMLBlock>

### Editing with AI Agents

AI agents benefit from installing the [ReadMe MCP Server](https://docs.readme.com/main/docs/readme-mcp) and related skills. This allows editing of project settings (cannot do via bi-directional sync), and the skills provide information on the structure of bi-directionally synced repositories.

## Troubleshooting

### Push rejected: the target branch is protected

If a synced branch has branch protection rules or rulesets, your Git provider can reject the commits ReadMe pushes to it. When that happens, **Settings > Git Connection** shows an error naming the affected branch:

![](https://files.readme.io/4c526af577ad473c856ce2cf0f85abe31c1bec9d1d7a92e7a2d448cfdea184ad-CleanShot_2026-09-29_at_10.42.54_AM2x.png)

**What you'll notice**

* Changes saved in ReadMe don't appear in your repository.
* Changes merged in Git can also stop appearing in ReadMe. This is most visible with API definitions: syncing an API definition requires ReadMe to write generated reference files back to the branch, so when that push is rejected the definition isn't updated, even though Markdown guides in the same commit may sync fine.
* The Git Connection still shows as **Connected**. The error is on the branch, not the connection.

**Why it happens**

ReadMe Sync pushes commits directly to your synced branches, and it doesn't automatically bypass the rules you've set on the repository. Any rule that blocks direct pushes will reject them: requiring a pull request, requiring reviews or status checks, requiring signed commits or linear history, or restricting who can push.

**How to fix it**

1. Allow the ReadMe integration to push to every synced branch. For GitHub, add the ReadMe Sync app to the bypass list by following [this guide](https://docs.readme.com/main/docs/sync-with-github#github-branch-protection). Rulesets and legacy branch protection are configured in different places, so check which one your repository uses. For GitLab, allow the account that set up the connection to push to the protected branch. For Bitbucket, ReadMe pushes as the ReadMe Sync app rather than as a user, so give the app write access by following [this guide](https://docs.readme.com/main/docs/sync-with-bitbucket#bitbucket-branch-restrictions).
2. Check for rules defined at the organization level. Organization rulesets apply on top of repository rules and need their own bypass entry.
3. If your repository settings are managed by an automated tool (a repo-settings config, a policy bot, or infrastructure-as-code), make the change there. Otherwise the next run of that tool will revert it.
4. Trigger a sync by saving a small change to the affected branch in ReadMe, or by pushing a new commit to it. Commits ReadMe couldn't push are sent on the next successful sync.
5. Confirm the error has cleared on **Settings > Git Connection**. If a change merged in Git still isn't showing, re-save the affected page or API definition in ReadMe once the push succeeds.

## FAQ

<Accordion title="How does ReadMe integrate with GitHub and what permissions are required?" icon="fa-question-circle">
  ReadMe uses a GitHub App with repo-level access: read-only for metadata(required) and read/write for syncing content. Webhooks handle syncs, change detection, and conflict resolution.
</Accordion>

<Accordion title="What permissions are required when syncing with GitLab?" icon="fa-question-circle">
  ReadMe requests access to:

  * `read_api` for listing projects
  * `read_user` and `read_profile` to display user information
  * `read_repository` to sync content in GitLab to ReadMe
  * `write_repository` to sync content in ReadMe to GitLab
</Accordion>

<Accordion title="What permissions are required when syncing with Bitbucket?" icon="fa-question-circle">
  ReadMe connects through the ReadMe Sync app for Bitbucket Cloud. The app requests:

  * `read:repository:bitbucket` to sync content in Bitbucket to ReadMe
  * `write:repository:bitbucket` to sync content in ReadMe to Bitbucket
  * `read:workspace:bitbucket` to identify the workspace the repository belongs to

  A workspace admin installs the app, and a repository admin connects each repository.
</Accordion>

<Accordion title="Sync says a push was rejected because the branch is protected." icon="fa-question-circle">
  Your branch protection rules are blocking ReadMe's pushes. Add the ReadMe integration to the bypass list for that branch and trigger a new sync. See [Troubleshooting](#troubleshooting) above for the full steps.
</Accordion>

<Accordion title="Why don’t I see a `changelogs` folder in my repository?" icon="fa-question-circle">
  Changelog entries only sync to the `main` branch, so check `main` rather than your version branches. If the folder still isn’t there, make sure `main` hasn’t been deleted and that branch protection isn’t blocking ReadMe Sync from pushing to it. Once that’s resolved, save an edit to any Changelog entry in ReadMe to trigger a sync. See [Branch Requirements](#main-branch-requirements) for details.
</Accordion>

# Sub pages

* [Sync with GitHub](https://docs.readme.com/main/docs/sync-with-github.md)
* [Sync with GitLab ](https://docs.readme.com/main/docs/sync-with-gitlab.md)
* [Sync with Bitbucket](https://docs.readme.com/main/docs/sync-with-bitbucket.md)
* [Documentation Structure](https://docs.readme.com/main/docs/documentation-structure.md)

# Sibling pages

* [Integrate into Your Workflow](https://docs.readme.com/main/docs/integrate-your-workflow.md)
* [Keep Your API Docs Synced With OpenAPI](https://docs.readme.com/main/docs/sync-docs-with-openapi.md)

# What's Next

* [Documentation Structure](https://docs.readme.com/main/docs/documentation-structure.md)
* [Branches](https://docs.readme.com/main/docs/branches.md)
* [Versioning](https://docs.readme.com/main/docs/versions.md)