# Add remote content from GitLab

Your project files can be stored in a remote repository on GitLab.
Connect that repository so you can access and publish those files in Redocly.

To connect a GitLab repository, you must first create a new access token in GitLab.
Afterward, you must create a new branch, enter the connection details, and merge the open pull request in the Redocly platform.

## Create a new access token in GitLab

Before entering the connection details in the Redocly platform, you need to create and copy a new access token for your account in GitLab.
Redocly uses this access token to establish a connection to your repository.
GitLab offers multiple types of access tokens.
The access token you use needs to have `api` scope and at least `Maintainer` role.

See the GitLab documentation for creating the following access token types with the API scope option:

- [Create a personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token)
- [Create a project access token](https://docs.gitlab.com/ee/user/project/settings/project_access_tokens.html#create-a-project-access-token)

## Create a new branch in Redocly

Before you make any changes to your project, create a new branch.
This new branch is a place where you can make changes without affecting the published site until you are ready.
Iterate on your changes based on reviews by your team.
After the updates have been approved, you can merge your changes into the published site.

To create a new branch:

1. From the Redocly platform editor, click the name of the current branch at the top of the page.
2. Enter the name for your new branch, for example `new-dev-branch`, and select **Create branch**.

  The platform automatically replaces spaces with hyphens **kbd** `-`because spaces are not allowed in branch names.

## Enter the connection details in Redocly

After you have created a new branch in Redocly, you can add remote content to your project.
Use the connection details you have collected from GitLab.

To enter the connection details in Redocly:

1. In the file tree, select the folder where you want to add the remote content.
  You can also click on the empty space to select the root directory.
2. Select **+ > New remote folder > Add Git repository** to add a remote content folder.
  To add a remote content file, select **+ > New remote file > Add Git repository**.
3. Enter a name for the new remote content (folder or file) and press the Enter or Return key.
4. From the list of Git providers, select **GitLab** or a self-managed GitLab instance.
5. Enter a **Credential name** for the new GitLab credential.
6. Enter the **Access token** you saved from the [Create a new access token in GitLab](#create-a-new-access-token-in-gitlab) step and select **Next**.
7. Select the **Namespace > Project > Branch**.
8. (Optional) Select the [**Folder**](/docs/platform/project/remote-content/remote-content#remote-contents-repository-folder) or [**File**](/docs/platform/project/remote-content/remote-content#remote-contents-repository-file), depending on whether you are adding a remote folder or a remote file.
9. (Optional) Select the [**Auto-sync**](/docs/platform/project/remote-content/remote-content#auto-sync-and-auto-merge) or [**Auto-merge**](/docs/platform/project/remote-content/remote-content#auto-sync-and-auto-merge) toggles to turn off either option.
10. Select **Add remote**.
  This action opens a pull request in Redocly automatically.

You can click the **View Pull Request** button next to your new branch name to view the pull request.

## Merge the open pull request in Redocly

After you enter the connection details in Redocly, a pull request to merge your updates with the default branch opens as a draft.
When you merge the pull request your changes are added to your main branch and a production deployment is triggered.

To merge the open pull request in Redocly:

1. Select the **View Pull Request** button next to your branch name.
2. Review your updates in the **Review** tab.
3. Select the **Ready for review** button to take the pull request out of draft.
4. After the tests have run and your pull request has been approved, click the **Merge** button to merge your updates with the default branch.

## Resources

- **[Connect a Git provider](/docs/platform/project/connect-git/connect-git-provider)** - Connect entire GitLab repositories to your project for comprehensive version control and automated documentation workflows
- **[Use the Editor](/docs/platform/project/use-editor)** - Leverage Redocly's collaborative editing environment for creating content with GitLab remote content integration and team collaboration
- **[Manage projects](/docs/platform/project/manage-projects)** - Access feedback, deployment details, and project settings for GitLab remote content-enabled documentation projects
- **[Configuration options](/docs/platform/config)** - Complete redocly.yaml configuration options for GitLab remote content integration and project customization
