Skip to main content

Deploy a CI/CD Pipeline via GitLab Self-Hosted

Connect a self-hosted GitLab repository and deploy it through an Elestio CI/CD pipeline.

This guide walks you through deploying a CI/CD pipeline using a self-hosted GitLab instance on Elestio.


Prerequisites​

Before you begin, make sure you have:

  • A running self-hosted GitLab instance (e.g. https://gitlab.example.com)
  • A Personal Access Token (PAT) with the api scope (see note below)
  • A repository hosted on your GitLab instance
  • An active project in Elestio

⚠️ Important: Only the api scope is required. Additional scopes like read_repository or read_user are not necessary when api is enabled.

*]:pointer-events-auto R6Vx5W_threadScrollVars scroll-mb-[calc(var(--scroll-root-safe-area-inset-bottom,0px)+var(--thread-response-height))] scroll-mt-[calc(var(--header-height)+min(200px,max(70px,20svh)))]" dir="auto">

info

You can follow our documentation to generate the PAT.


Step 1: Select Deployment Method​
  1. Open your project in the Elestio dashboard
  2. Navigate to CI/CD → Create Pipeline
  3. Under Deployment Method, select GitLab

image.png


Step 2: Choose Hosting Type​

After selecting GitLab, choose your hosting type:

OptionDescription
CloudConnect to GitLab.com via OAuth
Self-HostedConnect using your own GitLab instance and PAT

Select Self-Hosted to continue.

image.png

Switching between Cloud and Self-Hosted will reset previously selected repositories and settings.


Step 3: Connect Your Self-Hosted GitLab Instance​

Enter your connection details:

  1. GitLab Instance URL

    • Example: https://gitlab.example.com
    • Must include protocol (http:// or https://)
    • No trailing slash
  2. Personal Access Token (PAT)

    • Paste your token (glpat-xxxxxxxxxxxx)
    • Field is masked for security
  3. Click Connect

image.png

Expected result​
  • ✅ Connected message:
    “Connected as [username] on [instance URL]."
  • Repository selection UI loads automatically
If connection fails​

Check:

  • Instance is publicly reachable
  • Token includes api scope
  • Token has not expired

Step 4: Select a Repository​

Once connected, the Import Git Repository section appears.

  1. Git Account

    • Your connected account is pre-selected
    • Use Add Git Account to connect another instance
  2. Git Scope (if available)

    • Select a user, group, or organization
  3. Repository List

    • Search or browse repositories
    • Private repos show a 🔒 icon
    • Click "Import" on your chosen repository

image.png

*]:pointer-events-auto R6Vx5W_threadScrollVars scroll-mb-[calc(var(--scroll-root-safe-area-inset-bottom,0px)+var(--thread-response-height))] scroll-mt-[calc(var(--header-height)+min(200px,max(70px,20svh)))]" dir="auto">> Now, click "Next," then choose the cloud provider, region, and plan. After that, configure the pipeline settings by selecting the application type, runtime, and port configuration to proceed with the deployment.


Adding Additional Self-Hosted Accounts​

To connect another GitLab instance:

  1. Open the Git Account dropdown

  2. Click Add Git Account

  3. Enter:

    • Instance URL
    • Personal Access Token (api scope)
  4. Click Connect

The new account becomes active immediately.

image.png


Troubleshooting​
IssueLikely CauseFix
Connection failsInvalid URL or tokenVerify URL format and regenerate the PAT.
No repositories listedMissing api scopeRecreate token with api
Branch not foundEmpty repo or wrong branchEnsure branch exists and has commits