Connect GitLab.com or a self-managed GitLab with an access token so Compiler can read your repositories.
Compiler can read your code from GitLab, from GitHub, or from both. You connect GitLab with a GitLab access token. You don’t need to create a GitLab application or set any environment variables.This guide covers GitLab.com and self-managed GitLab.
Prerequisites
You’re an owner or admin of your Compiler organization.
A GitLab account that can create an access token for the groups or projects Compiler should read.
Step 1: Create a bot user
Compiler reads every project the access token can see. Create the token on a dedicated bot user rather than your own account. That way you control exactly what Compiler can read.
Create a GitLab user for Compiler, for example compiler-bot.
Add it as a member of the groups or projects Compiler should read, with at least the Reporter role.
To give Compiler more repositories later, add the bot user to more groups or projects. Nothing in Compiler needs to change.
Step 2: Create an access token
Compiler accepts a personal, group or project access token. A personal token must be a legacy token.
Fine-grained tokens aren’t supported. Compiler refuses them, saying to use a legacy token with the read_api and read_repository scopes.
Personal access token
Group or project access token
Sign in to GitLab as the bot user.
Open your user settings and go to Access tokens.
On GitLab.com, click Generate token and choose Legacy token. On a self-managed GitLab, click Add new token.
Give it a name such as Compiler, and set an expiry date.
Select the scopes from the table below.
Click Create token and copy it.
In Compiler’s token form, the user settings link opens this form already filled in, with the name Compiler and the read_api, read_repository and self_rotate scopes. Sign in as the bot user first.
In GitLab, open the group or project, then Settings > Access tokens.
Click Add new token, give it a name such as Compiler, and set an expiry date.
Set the role to Reporter or higher.
Select the scopes from the table below.
Click Create token and copy it.
A group or project access token only reads that group or project.
The token needs these scopes:
Scope
Required
Purpose
read_api
Yes
List projects and read repository details
read_repository
Yes
Clone and fetch repositories
self_rotate
No
Let Compiler renew the token before it expires
A personal access token with the api scope also works instead of read_api, but it grants write access that Compiler doesn’t use.
Copy the token before you leave the page. GitLab only shows it once.
Step 3: Connect GitLab
During setup
From settings
After you create the owner account, setup asks for a GitHub App. Below the form, next to Code on GitLab?, click Connect GitLab instead.
Click Connect GitLab.
Paste the token into API access token.
For self-managed GitLab, enter its address in Custom GitLab URL (optional, self-hosted only), for example https://gitlab.your-company.com. Leave it blank for GitLab.com.
Click Connect.
Setup then moves on to choosing your AI provider and creating your first project, where you pick repositories from GitLab.
In Compiler, open Settings > GitLab.
Under Connections, click Connect GitLab.
Paste the token into API access token.
For self-managed GitLab, enter its address in Custom GitLab URL (optional, self-hosted only), for example https://gitlab.your-company.com. Leave it blank for GitLab.com.
Click Connect.
Compiler checks the token before it saves it. The token is stored encrypted.
For self-managed GitLab, your instance needs to reach that address. If your network restricts egress, allow it alongside the other outbound hosts.
Step 4: Add repositories to a project
If you connected GitLab during setup, your first project already has the repositories you picked. To add more, or to add them to another project, use settings.Once connected, Settings > GitLab lists the repositories the token can read under Repositories.To add them to a project:
Open Settings, choose the project, and go to Repositories.
Under Add repository, pick repositories from GitLab. Projects in nested groups are included.
If you’ve also connected a GitHub App, the list shows repositories from both, each with its provider’s icon, and a project can mix them.You can also add a public repository by pasting its URL. Compiler adds it from whichever provider it belongs to: github.com, gitlab.com or your connected self-managed GitLab.Compiler clones the repositories in the background. You can start asking questions while they sync.If no repositories appear, add the bot user to a GitLab group or project with at least the Reporter role.
Token expiry
GitLab access tokens expire. Settings > GitLab shows the expiry date next to the connection.
If the token has the self_rotate scope, Compiler renews it automatically before it expires.
Otherwise, create a new token and replace it before the old one expires. Open the ⋯ menu next to the connection and choose Replace access token.
If GitLab stops accepting the token, because it was revoked or it expired, the page says the connection needs reconnecting. Replace the access token, or click Reconnect GitLab, and paste a new one.
Disconnect
Open the ⋯ menu next to the connection and choose Disconnect, then Disconnect now.Repositories already in projects stay, with the code they last synced.To connect a different GitLab, for example to move from GitLab.com to a self-managed GitLab, first remove the repositories from the current GitLab from every project.
Scopes summary
Scope
Required
Purpose
read_api
Yes
List projects, read details
read_repository
Yes
Clone and fetch repositories
self_rotate
No
Renew the token automatically
All others
No
Not used
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Compiler","colors":{"primary":"#171717","light":"#FAFAFA","dark":"#171717"},"logo":{"light":"https://mintcdn.com/compiler-9dddb267/jNXSXtd3Ltw19oTr/logo/light.svg?fit=max\u0026auto=format\u0026n=jNXSXtd3Ltw19oTr\u0026q=85\u0026s=1a803e826be437d2e60d826c19bedcd2","dark":"https://mintcdn.com/compiler-9dddb267/jNXSXtd3Ltw19oTr/logo/dark.svg?fit=max\u0026auto=format\u0026n=jNXSXtd3Ltw19oTr\u0026q=85\u0026s=4fcfa2bdddfdaaa5c1fdce85f3fc81b7"},"favicon":{"light":"https://mintcdn.com/compiler-9dddb267/jNXSXtd3Ltw19oTr/favicon-light.svg?fit=max\u0026auto=format\u0026n=jNXSXtd3Ltw19oTr\u0026q=85\u0026s=82f242601f6554a990e4a863918b510d","dark":"https://mintcdn.com/compiler-9dddb267/jNXSXtd3Ltw19oTr/favicon.svg?fit=max\u0026auto=format\u0026n=jNXSXtd3Ltw19oTr\u0026q=85\u0026s=3b53f6302d303b4d57ac1a5c2a119e0d"},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"compiler-9dddb267","hasAudioNarration":false,"actualSubdomain":"compiler-9dddb267","customDomains":["docs.usecompiler.com"],"gitSource":{"type":"github","owner":"usecompiler","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"DISABLED"},"WEB_MCP":{"status":"DISABLED"},"NARRATION":{"status":"DISABLED"}},"buildId":"6af4d62eb80170a5654e8922","clientVersion":"0.0.4143","searchFilterCounts":[{"language":"default","tag":"Configuration","count":8},{"language":"default","tag":"Deployment","count":3},{"language":"default","tag":"Reference","count":2},{"language":"default","tag":"Getting started","count":2}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"configuration/gitlab","slug":"/configuration/gitlab","pageMetadata":{"title":"GitLab","description":"Connect GitLab.com or a self-managed GitLab with an access token so Compiler can read your repositories.","icon":"gitlab","href":"/configuration/gitlab"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Connect GitLab.com or a self-managed GitLab with an access token so Compiler can read your repositories.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,ol:`ol`,p:`p`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{Heading,Note,Tab,Table,Tabs,Tip,Warning}=_components;if(!Heading)_missingMdxReference(`Heading`,true);if(!Note)_missingMdxReference(`Note`,true);if(!Tab)_missingMdxReference(`Tab`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tabs)_missingMdxReference(`Tabs`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Compiler can read your code from GitLab, from GitHub, or from both. You connect GitLab with a GitLab access token. You don’t need to create a GitLab application or set any environment variables.`}),`\n`,_jsx(_components.p,{children:`This guide covers GitLab.com and self-managed GitLab.`}),`\n`,_jsx(Heading,{level:`2`,id:`prerequisites`,children:`Prerequisites`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`You’re an owner or admin of your Compiler organization.`}),`\n`,_jsx(_components.li,{children:`A GitLab account that can create an access token for the groups or projects Compiler should read.`}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`step-1-create-a-bot-user`,children:`Step 1: Create a bot user`}),`\n`,_jsx(_components.p,{children:`Compiler reads every project the access token can see. Create the token on a dedicated bot user rather than your own account. That way you control exactly what Compiler can read.`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Create a GitLab user for Compiler, for example `,_jsx(_components.code,{children:`compiler-bot`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Add it as a member of the groups or projects Compiler should read, with at least the `,_jsx(_components.strong,{children:`Reporter`}),` role.`]}),`\n`]}),`\n`,_jsx(Tip,{children:_jsx(_components.p,{children:`To give Compiler more repositories later, add the bot user to more groups or projects. Nothing in Compiler needs to change.`})}),`\n`,_jsx(Heading,{level:`2`,id:`step-2-create-an-access-token`,children:`Step 2: Create an access token`}),`\n`,_jsx(_components.p,{children:`Compiler accepts a personal, group or project access token. A personal token must be a legacy token.`}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`Fine-grained tokens aren’t supported. Compiler refuses them, saying to use a legacy token with the `,_jsx(_components.code,{children:`read_api`}),` and `,_jsx(_components.code,{children:`read_repository`}),` scopes.`]})}),`\n`,_jsxs(Tabs,{children:[_jsxs(Tab,{title:`Personal access token`,id:`personal-access-token`,children:[_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Sign in to GitLab as the bot user.`}),`\n`,_jsxs(_components.li,{children:[`Open your user settings and go to `,_jsx(_components.strong,{children:`Access tokens`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`On GitLab.com, click `,_jsx(_components.strong,{children:`Generate token`}),` and choose `,_jsx(_components.strong,{children:`Legacy token`}),`. On a self-managed GitLab, click `,_jsx(_components.strong,{children:`Add new token`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Give it a name such as `,_jsx(_components.code,{children:`Compiler`}),`, and set an expiry date.`]}),`\n`,_jsx(_components.li,{children:`Select the scopes from the table below.`}),`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Create token`}),` and copy it.`]}),`\n`]}),_jsx(Tip,{children:_jsxs(_components.p,{children:[`In Compiler’s token form, the `,_jsx(_components.strong,{children:`user settings`}),` link opens this form already filled in, with the name `,_jsx(_components.code,{children:`Compiler`}),` and the `,_jsx(_components.code,{children:`read_api`}),`, `,_jsx(_components.code,{children:`read_repository`}),` and `,_jsx(_components.code,{children:`self_rotate`}),` scopes. Sign in as the bot user first.`]})})]}),_jsxs(Tab,{title:`Group or project access token`,id:`group-or-project-access-token`,children:[_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`In GitLab, open the group or project, then `,_jsx(_components.strong,{children:`Settings`}),` > `,_jsx(_components.strong,{children:`Access tokens`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Add new token`}),`, give it a name such as `,_jsx(_components.code,{children:`Compiler`}),`, and set an expiry date.`]}),`\n`,_jsxs(_components.li,{children:[`Set the role to `,_jsx(_components.strong,{children:`Reporter`}),` or higher.`]}),`\n`,_jsx(_components.li,{children:`Select the scopes from the table below.`}),`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Create token`}),` and copy it.`]}),`\n`]}),_jsx(_components.p,{children:`A group or project access token only reads that group or project.`})]})]}),`\n`,_jsx(_components.p,{children:`The token needs these scopes:`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Scope`}),_jsx(_components.th,{children:`Required`}),_jsx(_components.th,{children:`Purpose`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`read_api`})}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`List projects and read repository details`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`read_repository`})}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`Clone and fetch repositories`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`self_rotate`})}),_jsx(_components.td,{children:`No`}),_jsx(_components.td,{children:`Let Compiler renew the token before it expires`})]})]})]}),`\n`,_jsxs(_components.p,{children:[`A personal access token with the `,_jsx(_components.code,{children:`api`}),` scope also works instead of `,_jsx(_components.code,{children:`read_api`}),`, but it grants write access that Compiler doesn’t use.`]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`Copy the token before you leave the page. GitLab only shows it once.`})}),`\n`,_jsx(Heading,{level:`2`,id:`step-3-connect-gitlab`,children:`Step 3: Connect GitLab`}),`\n`,_jsxs(Tabs,{children:[_jsxs(Tab,{title:`During setup`,id:`during-setup`,children:[_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`After you create the owner account, setup asks for a GitHub App. Below the form, next to `,_jsx(_components.strong,{children:`Code on GitLab?`}),`, click `,_jsx(_components.strong,{children:`Connect GitLab instead`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Connect GitLab`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Paste the token into `,_jsx(_components.strong,{children:`API access token`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`For self-managed GitLab, enter its address in `,_jsx(_components.strong,{children:`Custom GitLab URL (optional, self-hosted only)`}),`, for example `,_jsx(_components.code,{children:`https://gitlab.your-company.com`}),`. Leave it blank for GitLab.com.`]}),`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Connect`}),`.`]}),`\n`]}),_jsx(_components.p,{children:`Setup then moves on to choosing your AI provider and creating your first project, where you pick repositories from GitLab.`})]}),_jsx(Tab,{title:`From settings`,id:`from-settings`,children:_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`In Compiler, open `,_jsx(_components.strong,{children:`Settings`}),` > `,_jsx(_components.strong,{children:`GitLab`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Under `,_jsx(_components.strong,{children:`Connections`}),`, click `,_jsx(_components.strong,{children:`Connect GitLab`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Paste the token into `,_jsx(_components.strong,{children:`API access token`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`For self-managed GitLab, enter its address in `,_jsx(_components.strong,{children:`Custom GitLab URL (optional, self-hosted only)`}),`, for example `,_jsx(_components.code,{children:`https://gitlab.your-company.com`}),`. Leave it blank for GitLab.com.`]}),`\n`,_jsxs(_components.li,{children:[`Click `,_jsx(_components.strong,{children:`Connect`}),`.`]}),`\n`]})})]}),`\n`,_jsx(_components.p,{children:`Compiler checks the token before it saves it. The token is stored encrypted.`}),`\n`,_jsx(Note,{children:_jsxs(_components.p,{children:[`For self-managed GitLab, your instance needs to reach that address. If your network restricts egress, allow it alongside the other `,_jsx(_components.a,{href:`/deployment/other-platforms#step-7-allow-outbound-access`,children:`outbound hosts`}),`.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`step-4-add-repositories-to-a-project`,children:`Step 4: Add repositories to a project`}),`\n`,_jsx(_components.p,{children:`If you connected GitLab during setup, your first project already has the repositories you picked. To add more, or to add them to another project, use settings.`}),`\n`,_jsxs(_components.p,{children:[`Once connected, `,_jsx(_components.strong,{children:`Settings`}),` > `,_jsx(_components.strong,{children:`GitLab`}),` lists the repositories the token can read under `,_jsx(_components.strong,{children:`Repositories`}),`.`]}),`\n`,_jsx(_components.p,{children:`To add them to a project:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[`Open `,_jsx(_components.strong,{children:`Settings`}),`, choose the project, and go to `,_jsx(_components.strong,{children:`Repositories`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Under `,_jsx(_components.strong,{children:`Add repository`}),`, pick repositories from GitLab. Projects in nested groups are included.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`If you’ve also connected a `,_jsx(_components.a,{href:`/configuration/github-app`,children:`GitHub App`}),`, the list shows repositories from both, each with its provider’s icon, and a project can mix them.`]}),`\n`,_jsx(_components.p,{children:`You can also add a public repository by pasting its URL. Compiler adds it from whichever provider it belongs to: github.com, gitlab.com or your connected self-managed GitLab.`}),`\n`,_jsx(_components.p,{children:`Compiler clones the repositories in the background. You can start asking questions while they sync.`}),`\n`,_jsxs(_components.p,{children:[`If no repositories appear, add the bot user to a GitLab group or project with at least the `,_jsx(_components.strong,{children:`Reporter`}),` role.`]}),`\n`,_jsx(Heading,{level:`2`,id:`token-expiry`,children:`Token expiry`}),`\n`,_jsxs(_components.p,{children:[`GitLab access tokens expire. `,_jsx(_components.strong,{children:`Settings`}),` > `,_jsx(_components.strong,{children:`GitLab`}),` shows the expiry date next to the connection.`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`If the token has the `,_jsx(_components.code,{children:`self_rotate`}),` scope, Compiler renews it automatically before it expires.`]}),`\n`,_jsxs(_components.li,{children:[`Otherwise, create a new token and replace it before the old one expires. Open the `,_jsx(_components.strong,{children:`⋯`}),` menu next to the connection and choose `,_jsx(_components.strong,{children:`Replace access token`}),`.`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`If GitLab stops accepting the token, because it was revoked or it expired, the page says the connection needs reconnecting. Replace the access token, or click `,_jsx(_components.strong,{children:`Reconnect GitLab`}),`, and paste a new one.`]}),`\n`,_jsx(Heading,{level:`2`,id:`disconnect`,children:`Disconnect`}),`\n`,_jsxs(_components.p,{children:[`Open the `,_jsx(_components.strong,{children:`⋯`}),` menu next to the connection and choose `,_jsx(_components.strong,{children:`Disconnect`}),`, then `,_jsx(_components.strong,{children:`Disconnect now`}),`.`]}),`\n`,_jsx(_components.p,{children:`Repositories already in projects stay, with the code they last synced.`}),`\n`,_jsx(_components.p,{children:`To connect a different GitLab, for example to move from GitLab.com to a self-managed GitLab, first remove the repositories from the current GitLab from every project.`}),`\n`,_jsx(Heading,{level:`2`,id:`scopes-summary`,children:`Scopes summary`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Scope`}),_jsx(_components.th,{children:`Required`}),_jsx(_components.th,{children:`Purpose`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`read_api`})}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`List projects, read details`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`read_repository`})}),_jsx(_components.td,{children:`Yes`}),_jsx(_components.td,{children:`Clone and fetch repositories`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:_jsx(_components.code,{children:`self_rotate`})}),_jsx(_components.td,{children:`No`}),_jsx(_components.td,{children:`Renew the token automatically`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`All others`}),_jsx(_components.td,{children:`No`}),_jsx(_components.td,{children:`Not used`})]})]})]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"GitLab","description":"Connect GitLab.com or a self-managed GitLab with an access token so Compiler can read your repositories.","icon":"gitlab","href":"/configuration/gitlab"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Prerequisites","slug":"prerequisites","depth":2,"children":[]},{"title":"Step 1: Create a bot user","slug":"step-1-create-a-bot-user","depth":2,"children":[]},{"title":"Step 2: Create an access token","slug":"step-2-create-an-access-token","depth":2,"children":[]},{"title":"Step 3: Connect GitLab","slug":"step-3-connect-gitlab","depth":2,"children":[]},{"title":"Step 4: Add repositories to a project","slug":"step-4-add-repositories-to-a-project","depth":2,"children":[]},{"title":"Token expiry","slug":"token-expiry","depth":2,"children":[]},{"title":"Disconnect","slug":"disconnect","depth":2,"children":[]},{"title":"Scopes summary","slug":"scopes-summary","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"compiler-9dddb267","siteName":"Compiler","title":"GitLab - Compiler","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-10-27T20:36:37.289Z","originalFileLocation":"configuration/gitlab.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Connect GitLab.com or a self-managed GitLab with an access token so Compiler can read your repositories.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Compiler\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/compiler-9dddb267/Q5L6gsQLsKGixuHL/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/compiler-9dddb267/Q5L6gsQLsKGixuHL/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/compiler-9dddb267/Q5L6gsQLsKGixuHL/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/compiler-9dddb267/Q5L6gsQLsKGixuHL/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/compiler-9dddb267/Q5L6gsQLsKGixuHL/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/compiler-9dddb267/Q5L6gsQLsKGixuHL/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/compiler-9dddb267/Q5L6gsQLsKGixuHL/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/compiler-9dddb267/Q5L6gsQLsKGixuHL/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/compiler-9dddb267/Q5L6gsQLsKGixuHL/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"GitLab - Compiler\">\u003cmeta data-mint-head property=\"og:description\" content=\"Connect GitLab.com or a self-managed GitLab with an access token so Compiler can read your repositories.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Compiler\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.usecompiler.com/configuration/gitlab\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://compiler-9dddb267.mintlify.site/_mintlify/api/og/v2?division=Configuration\u0026amp;title=GitLab\u0026amp;description=Connect+GitLab.com+or+a+self-managed+GitLab+with+an+access+token+so+Compiler+can+read+your+repositories.\u0026amp;theme=6a745556c4df827f9e47ffea\u0026amp;signature=45a28ea940244f101a249250d0bce6032f0427bcf38f7042845c3154e9750e67\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"GitLab - Compiler\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Connect GitLab.com or a self-managed GitLab with an access token so Compiler can read your repositories.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://compiler-9dddb267.mintlify.site/_mintlify/api/og/v2?division=Configuration\u0026amp;title=GitLab\u0026amp;description=Connect+GitLab.com+or+a+self-managed+GitLab+with+an+access+token+so+Compiler+can+read+your+repositories.\u0026amp;theme=6a745556c4df827f9e47ffea\u0026amp;signature=45a28ea940244f101a249250d0bce6032f0427bcf38f7042845c3154e9750e67\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/compiler-9dddb267/Q5L6gsQLsKGixuHL/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Compiler\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#171717\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.usecompiler.com/configuration/gitlab\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/configuration/gitlab.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.usecompiler.com/#organization\",\"name\":\"Compiler\",\"url\":\"https://docs.usecompiler.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/compiler-9dddb267/jNXSXtd3Ltw19oTr/logo/light.svg?fit=max\u0026auto=format\u0026n=jNXSXtd3Ltw19oTr\u0026q=85\u0026s=1a803e826be437d2e60d826c19bedcd2\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.usecompiler.com#website\",\"name\":\"Compiler\",\"url\":\"https://docs.usecompiler.com\",\"publisher\":{\"@id\":\"https://docs.usecompiler.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.usecompiler.com/configuration/gitlab#webpage\",\"url\":\"https://docs.usecompiler.com/configuration/gitlab\",\"name\":\"GitLab\",\"description\":\"Connect GitLab.com or a self-managed GitLab with an access token so Compiler can read your repositories.\",\"dateModified\":\"2026-10-27T20:36:37.289Z\",\"isPartOf\":{\"@id\":\"https://docs.usecompiler.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.usecompiler.com/configuration/gitlab#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.usecompiler.com/configuration/gitlab#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Configuration\",\"item\":\"https://docs.usecompiler.com/configuration/github-app\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"GitLab\",\"item\":\"https://docs.usecompiler.com/configuration/gitlab\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.usecompiler.com/configuration/gitlab#article\",\"headline\":\"GitLab\",\"name\":\"GitLab\",\"description\":\"Connect GitLab.com or a self-managed GitLab with an access token so Compiler can read your repositories.\",\"url\":\"https://docs.usecompiler.com/configuration/gitlab\",\"mainEntityOfPage\":{\"@id\":\"https://docs.usecompiler.com/configuration/gitlab#webpage\"},\"dateModified\":\"2026-10-27T20:36:37.289Z\",\"publisher\":{\"@id\":\"https://docs.usecompiler.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.usecompiler.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Compiler\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Compiler\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/configuration/gitlab.md","siteName":"Compiler","nav":{"global":null,"pages":[{"group":"Getting started","pages":[{"title":"Introduction","href":"/index"},{"title":"Quickstart","href":"/quickstart"}]},{"group":"Deployment","pages":[{"title":"Docker","icon":"docker","href":"/deployment/docker"},{"title":"Heroku","icon":"cloud","href":"/deployment/heroku"},{"title":"Other platforms","icon":"cubes","href":"/deployment/other-platforms"}]},{"group":"Configuration","pages":[{"title":"GitHub App","description":"Create a private GitHub App to connect your instance with your repositories.","icon":"github","href":"/configuration/github-app"},{"title":"GitLab","icon":"gitlab","href":"/configuration/gitlab"},{"title":"AWS Bedrock","description":"Create AWS credentials to use Claude through AWS Bedrock instead of the Anthropic API.","icon":"aws","href":"/configuration/aws-bedrock"},{"title":"Storage","icon":"hard-drive","href":"/configuration/storage"},{"title":"Slack","icon":"slack","href":"/configuration/slack"},{"title":"Connectors","icon":"puzzle-piece","href":"/configuration/connectors"},{"title":"MCP server","icon":"plug","href":"/configuration/mcp-server"},{"title":"Single sign-on","icon":"key","href":"/configuration/single-sign-on"}]},{"group":"Reference","pages":[{"title":"Environment variables","icon":"sliders","href":"/reference/environment-variables"},{"title":"Changelog","icon":"clock-rotate-left","href":"/changelog"}]}]},"basePath":"","title":"GitLab - Compiler","buildId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","deploymentId":"dpl_Fyv1NbzwP68g2bEH2Roy98uY1zmE","dynamics":[],"chunks":[]}