You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 16, 2025. It is now read-only.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
This guide will assist you in effectively integrating CodeRabbit with SaaS GitLab.
## How it works
CodeRabbit integrates with GitLab to enhance code review and collaboration by:
For the CodeRabbit app to post reviews on merge requests, it needs to interact with the GitLab API, which requires a Personal Access Token. This token can be generated either by using our default CodeRabbit user or by creating a Personal Access Token from one of your existing users.
- Automatically initiating code reviews for newly created merge requests.
- Displaying review comments and suggestions directly on merge requests.
- Enabling seamless interaction with the CodeRabbit bot for real-time feedback and assistance.
The CodeRabbit default user, named "coderabbitai", is already set up in GitLab SaaS and will be added to your project when you install the CodeRabbit app. During installation, the necessary webhook for the project will also be created.
If your organization prefers to use an organization user, you can create a new user in GitLab and generate a Personal Access Token for that user, following [our recommendations](#recommendations).
This guide will assist you in effectively integrating CodeRabbit with SaaS GitLab.
:::note
## GitLab Access Tokens
Keep in mind that if you wanttochange the review user, you can either disable the organization user or add a new user viatheCodeRabbit UI. However, this will require manually removingtheprevious user from the projectsandassociated webhooks. Afterward, you will need to reinstall the CodeRabbit app for each project.
To enable CodeRabbittointeract with your GitLab repositories, an access token is required. This token grantsthenecessary permissions for interacting withtheMerge RequestsandDiscussions APIs.
:::
1. Personal Access Token (PAT): You can create a new GitLab account specifically for CodeRabbit, name it “CodeRabbit” and treat it as a service account. Then generate a PAT from it where PAT will enable seamless integration between CodeRabbit and your GitLab repositories.
2. Group Access Token: If your organization uses GitLab Premium or Ultimate, you can generate a Group Access Token. This option automatically creates a bot user associated with the group for managing access and posting reviews.
## GitLab AccessTokens
### Personal AccessToken
To interact with the GitLab API, a **Personal Access Token** is required. This token can either be generated by using our defaultCodeRabbituser or by creating a **Personal Access Token** from one of your existing users.
We recommend creating a new user as a service account, associating this user to the group you'd like to install CodeRabbit on, and providingCodeRabbitwith the personal access token to allow access. During the installation process, CodeRabbit will automatically configure the required webhook for seamless integration.
Upon first login to the application (immediately after the onboarding screen), you will need to choose based on your organization's requirements.
<div class="center-image">
<img
src="/img/integrations/gitlab_user_choice.png"
alt="GitLab user modal choice"
width="1000"
/>
</div>

**We recommend using the default CodeRabbit user** for most organizations, as it is pre-configured. However, we understand that some organizations may prefer more control over the user or have restrictions regarding user inclusion within their organization.
:::note
### Personal Access Tokens
If you wish to change the review user, you must provide the access token for the new user who will post reviews and comments. However, this requires manually removing the previous user from the projects and associated webhooks. Once this is done, you will need to reinstall the CodeRabbit app for each project.
If your organization opts to use another user within the organization, you can do so by [generating a personal access token](#generating-a-personal-access-token).
:::

- **Create a dedicated user for CodeRabbit** - This ensures the user is exclusively for CodeRabbit, allowing better access control.
- **Use "CodeRabbit" as the username** - This makes the user easily recognizable for future reference.
- **Use a dedicated email address** - This helps in easy identification and management.
- **Use the CodeRabbit logo as the profile picture** - This further ensures easy recognition. You can download our logo from [here](/img/integrations/logo.svg "download").
- **Developer Access** Ensure the service account user has developer access to the group or projects that you wish to install CodeRabbit on.
#### Key Points to Remember
- Personal access tokens have expiration dates. Ensure the expiration date covers the duration of your intended use oftheCodeRabbit app.
- Personal access tokens have expiration dates. Ensure the expiration date**covers the duration** of your intended use of CodeRabbit.
- Code reviews will be attributed to the owner of the personal access token.
- If the personal access token expires, you can add a new one via the CodeRabbit UI:
- Navigate to the"GitLab User" page in the sidebar.
-Click the"Update" button on the displayed card to seethesame modal as theinitial login.
- Navigate to the**GitLab User** page in the sidebar.
-Enter thenew Access token, and clickthe**Update** button on thepage.
### Generating a Personal Access Token
#### Generating a Personal Access Token
GitLab provides an option to generate a personal access token for a new user. Follow these steps to generate the token:
1. Log inas the userintended for CodeRabbit reviews.
1. Log inusing the userdesignated for CodeRabbit reviews. This user serves as a service account for managing reviews and related activities.
2. Select your avatar on the left sidebar.
3. Choose"Edit Profile."
4. Select"Access Tokens" from the left sidebar.
5.[Click"Add New Token."](https://gitlab.com/-/user_settings/personal_access_tokens)
3. Choose**Edit Profile**.
4. Select**Access Tokens** from the left sidebar.
5. Click[Add New Token.](https://gitlab.com/-/user_settings/personal_access_tokens)
6. Enter a name and an expiry date for the token.
7. If no expiry date is entered, it defaults to 365 days from the current date.
8. Ensure the following scopes are selected: `api`, `read_api`, `read_user`.
9. Click"Create Personal Access Token."
9. Click**Create Personal Access Token**
10. Note down the token as it will only be displayed once.

<div class="center-image">
<img
src="/img/integrations/admin-access-token.png"
alt="GitLab personal access token configuration page"
width="1000"
/>
</div>
### Installing CodeRabbit into your GitLab Repositories
---
1. Go to the [Repositories page](https://app.coderabbit.ai/settings/repositories) in the CodeRabbit app.
2. Click the check box to the left of the repos you want to install CodeRabbit into. Click the box at the top to install onto all repos at once.
3. Click **Install Repositories**.
### Group Access Token
Creating a Group Access Token in GitLab automatically generates a bot user. Ensure that the token is configured with Developer access. Once set up, you only need to provide this token for integration. Note that a Group Access Token is limited to the scope of the group where it was created. To configure additional groups, you will need to generate a separate Group Access Token for each group.
By default, if no access token is provided, CodeRabbit will prompt you to provide one during the installation process. However, if you wish to provide the token beforehand, you can do so by navigating to the **Organization Settings** tab, and selecting the **GitLab User** tab on the sidebar. Once entering the token, the token will be validated and saved for future use.
You can confirm the correct user is being selected by verifying the user ID shown on the UI with the user ID of the service account user you created.
---
### Installing CodeRabbit into your GitLab Repositories
1. Go to the [Repositories page](https://app.coderabbit.ai/settings/repositories) in the CodeRabbit app.
2. Select the checkbox next to the repositories where you want to install CodeRabbit. To install it on all repositories at once, select the checkbox at the top.
3. Select **Install Repositories**.
<div class="center-image">
<img
src="/img/integrations/gitlab-repo-install.png"
alt="GitLab Repo Install Modal"
width="1000"
/>
</div>
The webhook `https://coderabbit.ai/gitlabHandler` will now be installed for the projects selected.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.