# Gitlab

### Prerequisites

* A Gitlab account with access to the repositories you wish to sync with Coworker.
* Depending on the configuration, either a Free or a Premium/Ultimate Gitlab plan

### Generating the credentials

{% embed url="<https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token>" %}
Gitlab Personal Access Token Generation Tutorial
{% endembed %}

1. You can generate a personal access token at <https://gitlab.com/-/user_settings/personal_access_tokens>
2. Click 'Add new token'
3. **Do not enter an expiration date, as you'll need to reconnect once it expires.** You can always revoke Village Labs' access to this token in future if required.
4. Select the required scopes:

   `api`
5. Next click 'Create personal access token' and copy / save your token.

{% hint style="info" %}
**Note:** Village will only read, and not write data from your Gitlab instance. The only reason why an `api`, and not `read_api` scope is required is because, during the connection's setup, a webhook is configured to push real-time updates from Gitlab to Coworker's infrastructure.&#x20;
{% endhint %}

### Information required for the Coworker connection:

* `access_token`: The access token created above
* `groups_list`: Your group ID, or a a comma-separated (no spaces) list of the group ids which should be synchronized. This field is required and cannot be left blank.
  * This requires a Gitlab Premium/Ultimate/Self-managed instance
* `projects_list`: A comma-separated (no spaces) list of the projects (or repositories) that should be synchronized. If left empty, Coworker will synchronize all projects that can be accessed (or within the groups configured above).&#x20;
  1. **Premium Tiers:** If you wish to synchronize all repositories (projects) under a group (see config below), a Gitlab Premium/Ultimate/Self-managed instance is required: data will be (in part) synchronized through [group hooks](https://docs.gitlab.com/ee/api/groups.html#hooks), which are not available in the Free Tier.
  2. **Free Tier:** If you have a Free Tier Gitlab instance, you will need to provide an explicit list of the projects to synchronize: the data will be synchronized (in part) through [project hooks](https://docs.gitlab.com/ee/api/projects.html#add-project-hook).
* `start_date`: Date of the first record to synchronize, in the following format: `2024-01-01T00:00:00Z` . Commits before this date will not be synchronized.


---

# 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://village-labs.gitbook.io/coworker-product-and-developer-docs/data-connections/gitlab.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.
