---
title: Import a GitLab repository
description: Cube Cloud onboarding that imports an existing Cube project from GitLab over SSH and links it to your database.
---

This guide walks you through setting up Cube Cloud, importing a [GitLab][gitlab]
repository with an existing Cube project via SSH, and connecting to your
database.

## Step 1: Create an account

Navigate to [cubecloud.dev](https://cubecloud.dev/), and create a new Cube Cloud
account.

## Step 2: Create a new Deployment

Click **Create Deployment**. This is the first step in the deployment
creation. Give it a name and select the cloud provider and region of your
choice.

<div style={{ textAlign: "center" }}>
  <img
    alt="Cube Cloud Create Deployment Screen"
    src="https://cubedev-blog-images.s3.us-east-2.amazonaws.com/f5b73cc7-ac72-49ff-a3cd-491c6ab89bbc.png"
    style={{ border: "none" }}
    width="100%"
  />
</div>

<Info>

Microsoft Azure is available on [Enterprise plan](https://cube.dev/pricing).
[Contact us](https://cube.dev/contact) for details.

</Info>

## Step 3: Import Git repository

Next up, the second step in creating a Cube App from scratch in Cube Cloud is to
click **Import Git repository via SSH**.

<div style={{ textAlign: "center" }}>
  <img
    alt="Cube Cloud Upload Project Screen"
    src="https://cubedev-blog-images.s3.us-east-2.amazonaws.com/4e212151-527b-4435-892c-257a11842e03.png"
    style={{ border: "none" }}
    width="100%"
  />
</div>

Now go to your GitLab repository and from the **Clone** dropdown menu,
copy the **Clone with SSH** URL:

<div style={{ textAlign: "center" }}>
  <img
    alt="Getting the repository's SSH URL from GitLab"
    src="https://cubedev-blog-images.s3.us-east-2.amazonaws.com/b8b4e25c-27ed-4304-a11b-1f96e6651960.png"
    style={{ border: "none" }}
    width="100%"
  />
</div>

Back in Cube Cloud, paste the URL and click **Generate SSH key**:

<div style={{ textAlign: "center" }}>
  <img
    alt="Getting SSH key from Cube Cloud"
    src="https://cubedev-blog-images.s3.us-east-2.amazonaws.com/ff06ef69-74bf-4259-ba4b-2499d3d5d265.png"
    style={{ border: "none" }}
    width="100%"
  />
</div>

Now copy the SSH key and go back to GitLab and paste it into the repository's
settings. Find the **Deploy keys** section and click **Expand**.
Give the key a title (`Cube Cloud`, for example) and paste the SSH key in the
relevant field:

<div style={{ textAlign: "center" }}>
  <img
    alt="Add Cube Cloud deploy key to GitLab"
    src="https://cubedev-blog-images.s3.us-east-2.amazonaws.com/0b4f165a-63e5-4d04-8a7f-a5bd0b91cb79.png"
    style={{ border: "none" }}
    width="100%"
  />
</div>

Ensure **Grant write permissions to this key** is checked, then
click **Add key**. Go back to Cube Cloud and click **Connect**.
After a connection is successfully established, you should see the next screen:

<div style={{ textAlign: "center" }}>
  <img
    alt="Getting webhook URL from Cube Cloud"
    src="https://cubedev-blog-images.s3.us-east-2.amazonaws.com/eda31adf-fd36-4757-a2a2-d9b919b890d3.png"
    style={{ border: "none" }}
    width="100%"
  />
</div>

Copy the **Cube Cloud Git Webhook URL** and go to your GitLab
project's **Webhooks** settings. Paste the URL into the correct field,
ensure the **Push events** trigger is checked and click **Add
webhook**.

<div style={{ textAlign: "center" }}>
  <img
    alt="Add Cube Cloud webhook to GitLab"
    src="https://cubedev-blog-images.s3.us-east-2.amazonaws.com/4a4f4bbf-a902-43d7-8437-85624b1aba92.png"
    style={{ border: "none" }}
    width="100%"
  />
</div>

Back in Cube Cloud, click **Connect** to test the webhook.

## Step 4: Connect your Database

Enter your credentials to connect to your database. Check the [connecting to
databases][link-connecting-to-databases] guide for more details.

<Info>

Want to use a sample database instead? We also have a sample database where you
can try out Cube Cloud:

<br />

| Field    | Value              |
| -------- | ------------------ |
| Host     | `demo-db.cube.dev` |
| Port     | `5432`             |
| Database | `ecom`             |
| Username | `cube`             |
| Password | `12345`            |

</Info>

<div style={{ textAlign: "center" }}>
  <img
    alt="Cube Cloud Setup Database Screen"
    src="https://cubedev-blog-images.s3.us-east-2.amazonaws.com/1375f9f1-0860-412a-a436-e2e775ec10fa.png"
    style={{ border: "none" }}
    width="100%"
  />
</div>

In the UI it'll look exactly like the image below.

<div style={{ textAlign: "center" }}>
  <img
    alt="Cube Cloud Setup Database Screen"
    src="https://cubedev-blog-images.s3.us-east-2.amazonaws.com/031bb948-d706-412c-b714-5bf28df01312.png"
    style={{ border: "none" }}
    width="100%"
  />
</div>

If you run into issues here, make sure to allow the Cube Cloud IPs to access
your database. This means you need to enable these IPs in your firewall. If you
are using AWS, this would mean adding a security group with allowed IPs.

## Step 5: Generate the Data Model

Step five in this case consists of generating data models. Start by selecting
the database tables to generate the data models from, then
hit **Generate**.

<div style={{ textAlign: "center" }}>
  <img
    alt="Generating data models for a new Cube Cloud deployment"
    src="https://cubedev-blog-images.s3.us-east-2.amazonaws.com/a906434b-c4da-414a-adb3-f010b1fa45d1.png"
    style={{ border: "none" }}
    width="100%"
  />
</div>

Cube Cloud will generate the data models and spin up your Cube deployment. With
this, you're done. You've created a Cube deployment, configured a database
connection, and generated data models!

<div style={{ textAlign: "center" }}>
  <img
    alt="Cube Cloud Playground"
    src="https://cubedev-blog-images.s3.us-east-2.amazonaws.com/b6addada-cc77-4940-aa0c-a0a9c3df6fd1.png"
    style={{ border: "none" }}
    width="100%"
  />
</div>

You're ready for the last step, running queries in the Playground.

## Step 6: Try out Cube Cloud

Now you can navigate to Playground to try out your queries or connect your
application to the Cube Cloud API.

<div style={{ textAlign: "center" }}>
  <img
    alt="Cube Cloud Playground"
    src="https://ucarecdn.com/43bc545a-3c77-42e4-a9db-7c5188fe610e/"
    style={{ border: "none" }}
    width="100%"
  />
</div>

[gitlab]: https://gitlab.com/
[link-connecting-to-databases]: /admin/connect-to-data/data-sources