> ## Documentation Index
> Fetch the complete documentation index at: https://docs.traversal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GitLab

> Connect GitLab to correlate incidents with recent code changes.

Connecting GitLab lets Traversal correlate incidents with recent code changes by pulling commits and merge requests, helping it explain "what changed" alongside telemetry evidence. Supports both **gitlab.com** and **self-hosted GitLab instances**.

## What Traversal reads

* **Merge requests** — recent MRs, diffs, and discussions
* **Commits** — commit history and changed files
* **Code** — file contents and code search results

## Repository access during investigations

Traversal can combine GitLab API data with a temporary checkout of an allowed project. API access provides merge request metadata, diffs, discussions, and individual file contents. A checkout lets the investigation inspect the wider codebase with local search and analysis tools when it needs more context.

Traversal can clone projects and inspect remote references using safe, read-only Git operations. GitLab API access—not a broad `glab` command surface—continues to provide merge request and code context beyond this focused repository checkout capability. The projects and groups available to an investigation remain limited by the GitLab integration's configuration and credentials.

Repository checkouts run in an ephemeral agent sandbox. Traversal isolates Git configuration for credentialed operations, provides credentials only for the sandbox operation, and redacts credential values from command output.

For example, you can ask Traversal to:

* "Inspect `mygroup/service-api` for the code path behind this error."
* "Compare the current implementation with the merge request linked to the incident."
* "Find where the affected service configures database connection timeouts."

<Note>
  Private or self-hosted GitLab endpoints require a Traversal Connector that can reach the endpoint. The configured GitLab URL must be the HTTPS hostname root, such as `https://gitlab.yourcompany.com`, without a path prefix.
</Note>

## Setup

<Tabs>
  <Tab title="Personal access token (recommended)">
    <Steps>
      <Step title="Create a token">
        1. Go to **User Settings > Access Tokens** ([gitlab.com/-/user\_settings/personal\_access\_tokens](https://gitlab.com/-/user_settings/personal_access_tokens))
        2. Click **Add new token**
        3. Set the read-only scopes `read_api` and `read_repository`, or use the broader `api` scope
        4. Click **Create personal access token** and copy the token immediately
      </Step>

      <Step title="Configure in Traversal">
        Go to **Company Knowledge > Integrations**, select GitLab, and paste the token.

        You can optionally scope access further:

        * Use **Project IDs** for a comma-separated list of project IDs or project paths such as `mygroup/service-api`
        * Use **Group ID** for group-wide access
      </Step>
    </Steps>
  </Tab>

  <Tab title="Project access token">
    <Steps>
      <Step title="Create a token">
        Go to your GitLab project's **Settings > Access Tokens** and create a token with `read_api` or `api` scope.
      </Step>

      <Step title="Configure in Traversal">
        Select **Project Access Token**, enter the numeric **Project ID** from project settings, and paste the token.
      </Step>
    </Steps>
  </Tab>

  <Tab title="Group access token">
    <Steps>
      <Step title="Create a token">
        Go to your GitLab group's **Settings > Access Tokens** and create a token with `read_api` or `api` scope.
      </Step>

      <Step title="Configure in Traversal">
        Select **Group Access Token**, enter the numeric **Group ID** from group settings, and paste the token.
      </Step>
    </Steps>
  </Tab>
</Tabs>

### Self-hosted GitLab

For self-hosted instances, expand **Self-Hosted Configuration** and enter your GitLab host base URL (for example, `https://gitlab.yourcompany.com`). Do not include `/api/v4`. Traversal appends that path automatically.

## Private network access

If the service endpoint is not directly reachable by Traversal (as is common with self-hosted services), deploy a [Traversal Connector](/architecture/connector) in a network that can reach it. When configuring the integration, select that connector under **Network Access Needed**. The service endpoint does not need public internet exposure.

See [Set up the Traversal Connector](/setup/connector) for deployment and network requirements.

## More information

* [GitLab personal access tokens](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html)
* [GitLab API documentation](https://docs.gitlab.com/ee/api/rest/)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.