# Importing your GitLab repositories

Once the integration of your SonarQube instance with GitLab has been properly set up, you can import a GitLab repository to create the corresponding project in SonarQube. To do so, you need the Create Project permission in SonarQube Server.

The so-created SonarQube project is "bound" to its GitLab repository. With a bound project:

* The project’s main branch name will be automatically set up from GitLab.
* The quality gate status report to the merge requests will be automatically set up.

{% hint style="info" %}
Starting in [Enterprise Edition](https://www.sonarsource.com/plans-and-pricing/enterprise/), you can import a GitLab monorepo. See [Managing monorepo projects](/sonarqube-server/2025.5/project-administration/monorepos.md).
{% endhint %}

## Step 1: Create a Personal Access Token <a href="#one-or-several" id="one-or-several"></a>

You must provide a[ GitLab Personal Access Token](https://docs.gitlab.com/user/profile/personal_access_tokens/) with `read_api` scope. This token will be stored in SonarQube and can be revoked at any time in GitLab. SonarQube will use this token to access and list your GitLab repositories. Copy it (you will have to paste it during Step 2). You may ask your administrator to encrypt this token.

## Step 2: Import one or several GitLab repositories <a href="#one-or-several" id="one-or-several"></a>

1. Go to **Projects**.
2. Select **Create Project** > **From GitLab**.The **GitLab project onboarding** page opens.
3. In **Personal Access Token**, enter the PAT you created in Step 1 and select **Save**. The repositories to which the PAT has access are listed on the page.
4. Select one or several repositories to be imported and follow the instructions.

## Related pages

[Setting up GitLab integration at global level](/sonarqube-server/2025.5/devops-platform-integration/gitlab-integration/global-setup.md)\
[Setting up GitLab integration at project level](/sonarqube-server/2025.5/devops-platform-integration/gitlab-integration/setting-up-at-project-level.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sonarsource.com/sonarqube-server/2025.5/devops-platform-integration/gitlab-integration/importing-repos.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
