Table of Contents
Connect GitLab with a Personal Access Token (PAT)
LinearB allows you to integrate GitLab with your account using a Personal Access Token (PAT).
If you do not have administrative access to your GitLab repository or lack the necessary permissions to authenticate your GitLab account with LinearB via OAuth, you can still establish a connection using a GitLab Personal Access Token (PAT).
However, you must be an organization owner or have "maintainer" or "owner" permissions for the relevant repositories to generate a PAT that grants LinearB the required.
Follow the steps below to generate your token and connect GitLab to LinearB.

1. Generate a Personal Access Token (PAT) in GitLab
To connect GitLab, you first need to create a Personal Access Token:
- Log in to GitLab and navigate to your User Settings.
- Select Access Tokens from the menu.
- Click Create a Personal Access Token.
- Provide a descriptive name for the token.
- Set an expiration date (optional but recommended for security).
- For optimal stability, set your Personal Access Token (PAT) to a long-term expiration date or, if possible, no expiration date.
- If a GitLab token expires, it may cause data inconsistencies between the time it expires and when a new token is added.
- If you encounter issues due to an expired token, please contact support@linearb.io for assistance in validating and resolving any data discrepancies.
- Assign the following scopes (permissions):
- read_api – Read access to API resources.
- read_api – Read access to API resources.
- read_user – Access user profile information.
- read_repository – Read-only access to repository content.
- write_repository – Allows LinearB to update repository content when needed.
- Click Create Personal Access Token and copy the token securely (it will not be viewable again).
For additional details, refer to the GitLab Personal Access Token Documentation.

Granting write_repository
Permissions and Alternative Authentication Methods
LinearB requires write_repository permissions to configure webhooks for real-time data collection. Without this permission, LinearB will still function, but data updates will be delayed by up to 2 hours instead of occurring in real time.
- This delay can impact metric accuracy and cause long wait times for WorkerB notifications on PR review requests and other time-sensitive updates.
Alternative Authentication Method
If write_repository cannot be granted due to security restrictions, consider using a service account in your GitLab organization:
- Set up a GitLab service account with admin permissions for all relevant repositories.
- Many GitLab instances already have a "global admins" group that can manage this.
- Connect the service account to LinearB using OAuth for a more streamlined and secure integration.
For more details, refer to GitLab’s documentation on creating groups in GitLab.

2. Connect GitLab to LinearB
Once you have generated a Personal Access Token (PAT), you can integrate it with LinearB:
- Navigate to Settings > Company Settings, and select the Git tab.
- Click Add Integration.
- Select GitLab as your Git provider.

- Paste your Personal Access Token (PAT) into the required field.
- Click Connect, and LinearB will begin processing your GitLab repositories.


Reauthorizing Your GitLab Token in LinearB
If your GitLab token has expired, follow these steps to reauthorize it with LinearB:
- Generate a new token by following the instructions in the "Generate a Personal Access Token (PAT) in GitLab" section above.
- In LinearB, navigate to Company Settings, and select the Git tab.
- Click the three-dot menu next to your existing GitLab token connection.
- Choose Reauthorize Git and enter your new Token ID.
Once updated, LinearB will resume processing your GitLab data without delays.


3. Troubleshooting & Support
- Ensure the PAT has the correct scopes (permissions).
- Verify that your GitLab account has sufficient access to the repositories you want to connect.
- If you encounter issues, contact LinearB Support or join our Dev Interrupted Discord Server for discussions on Git and DevOps.

Related Guides
- BitBucket Server (On-Prem) Connection Guide
- Connect Azure Repos Using a Personal Access Token
- Microsoft Entra (Azure AD) - SSO Configuration
For additional support, visit our HelpDocs Support Page.
How did we do?
Connect Azure Repos Using a Personal Access Token
Connect Your GitHub Account to LinearB