Skip to main content
For what differs between this platform and the others, see Platform Support.
Gitar connects to GitLab using a personal access token (PAT) from a service account or dedicated user. Gitar posts comments and pushes changes under that account’s identity, so use an account reserved for Gitar.

Prerequisites

  • A Gitar account with the organization admin role, signed in to the organization being connected.
  • GitLab.com, or GitLab Self-Managed or Dedicated version 16.0 or later. Service accounts became generally available on GitLab Free in 18.11, but GitLab Self-Managed Community Edition cannot create them. For Community Edition or any instance/version without service accounts, use a dedicated user’s PAT.
  • A service account (preferred) or dedicated user, with access to the group and the Maintainer or Owner role on the projects being connected.
Gitar registers a webhook on each connected project, on every tier. Project webhooks carry every event Gitar consumes and need only the Maintainer role. To connect projects created later, enable automatic connection or add them from Configure.

Setup Instructions

1

Choose an account

Use this path only when the instance has no Service accounts menu, since a dedicated user works without GitLab’s service account feature. Create a regular GitLab user reserved for Gitar, such as gitar-bot-acme.This approach is a fallback, not the preferred option: a dedicated user occupies a normal seat on the GitLab instance, and its PAT becomes invalid if that user’s account is ever removed or deactivated. Prefer a service account whenever your GitLab edition and version support one.Keep this account separate from daily development. Gitar treats comments from the connected account as its own and does not respond to them.
2

Generate a personal access token

For a service account, open Settings → Service accounts, then select Manage access tokens next to the account. For a dedicated user, sign in as that user and open its personal access tokens page instead.
  1. Open the account’s access token page
  2. Select Add new token
  3. Enter a token name and set an expiration date. Note this date so you can rotate the token before it expires
  4. Select the api scope, then select Generate token
  5. Copy the token immediately, as GitLab will not show it again
Group and project access tokens are not supported. Generate the PAT from the service account (preferred) or dedicated user that Gitar will act as.
The api scope covers repository access and API reads and writes, including posting comments and setting up webhooks. Read-only scopes combined with write_repository do not permit these API writes.
3

Invite the account to your group

Invite the service account or dedicated user to the group Gitar will work in:
  1. Go to that group in GitLab
  2. On the left sidebar, select Manage → Members
  3. Select Invite members
  4. Search for the account, assign the Maintainer or Owner role, then select Invite
Maintainer is enough for project webhooks and review actions, including pushing fix branches. Merge blocking depends on GitLab’s approval-rule support, not on whether you chose a service account or a dedicated user.
Invite the account to the group whose path you enter in the next step. Membership inherits downwards, so inviting it to a parent group also covers every subgroup and project beneath it. Inviting it to a subgroup gives it no access to the parent.
4

Connect in Gitar

Create one connection per GitLab host in each Gitar organization. The same connection can cover multiple top-level groups that the connected account can access. After connecting, select those groups under Configure Repository Access.Use the generated token to configure the connection with the following fields:
  • GitLab Host: The hostname of your GitLab instance, for example gitlab.com or gitlab.example.com
  • Group/Namespace Path: The full path of the group, including any parent groups. acme for gitlab.com/acme, or acme/platform for a subgroup
  • Project ID (Optional): Find your project ID in GitLab project settings
  • Personal Access Token: The token you generated above, with the api scope
Gitar validates the token as you enter it and reports any problem with the host, the token, or access to the group.
Open Settings → Configuration → Connections, then select Configure for the GitLab connection to update its token or add groups and projects.

Configure Repository Access

To onboard everything under the connected GitLab group, select that parent group in Groups. Gitar connects all existing projects in the group and every subgroup the connected account can access, without adding them individually.
  1. Open Settings → Configuration → Connections and select Configure for the existing GitLab connection.
  2. Keep the default Groups tab selected.
  3. Search for the top-level group’s full path, such as acme, and select the matching group.
  4. Review the project preview, then select Onboard N projects. Gitar includes projects in subgroups such as acme/platform and acme/mobile, subject to the connected account’s permissions.
For individual repositories, switch to Projects, search by name or full project path, and select Add, then Save. The screenshot below shows the Projects view with the earlier tab order. Groups opens by default on the left, with Projects on the right.

Multiple Top-Level Groups on One Host

Reuse the existing connection for each top-level group on the same GitLab host. Reopen Configure → Groups and repeat the steps above for each group. A second connection to the same host is rejected. The connected account must have access to every group being added. Choose an account that GitLab permits you to invite to each group, taking account type and SSO restrictions into account. See the service-account guidance above.
One connection does not automatically connect an entire GitLab instance. Select each top-level group explicitly.

Connect new projects automatically

Organization admins can enable automatic connection for selected groups. Without it, add new projects manually from Configure.
  1. Open Settings → Configuration → Connections and select Configure for the GitLab connection.
  2. Open the Auto-connect tab and enable Automatically connect projects.
  3. Search for a group under Add groups.
  4. Select Add beside the group. Repeat for each group to watch.
  5. To watch only a group itself, clear Include subgroups for that group.
  6. Select Save changes.
Gitar checks the selected groups periodically and connects projects the connected account can access. Projects you disconnect manually stay disconnected.

Merge Blocking

With Block merges enabled, Gitar creates an MR approval rule when findings meet the configured blocking threshold. GitLab must enforce approval rules for that rule to prevent merging, generally on Premium or Ultimate. Gitar checks the connected GitLab.com namespace’s plan during connection and refresh. When capability is uncertain, including on self-managed instances, Gitar checks enforcement on the MR. Where rules are not enforced, Gitar reports findings without claiming a native merge block. To hold qualifying GitLab pushes while Gitar reviews them, see Require Gitar before merging. Without enforced approval rules, a CI job can fail on stored findings through Get MR Status. This is not a guarantee that Gitar reviewed the current commit: the example passes for pending and does not compare commit SHAs.

Self-Hosted GitLab: Git Hooks Configuration

If GitLab rejects a Gitar fix push because of an email policy, start with the email address and rule named in the rejection message. If the rejected commit is available, inspect both its author and committer addresses. Do not assume every commit uses noreply@gitar.ai. GitLab’s Commit author’s email push rule checks both addresses against its regular expression. Reject unverified users requires the committer address to match a verified or private commit address on the pushing account. Open the GitLab project’s Settings -> Repository -> Push rules and check the connected account’s commit-email settings. For custom pre-receive or update hooks, check the same addresses against the hook’s policy. Use an address accepted by the account and your organization’s policy rather than adding a shared address to the account. See GitLab push rules for the individual checks. Commit signing and host verification are separate requirements. See Signed Commits.

Firewall / IP Allowlisting

If your GitLab group or instance enforces an IP allowlist, add every address listed in Network Access. After changing the allowlist, open Settings → Configuration in Gitar and click Refresh in the Repositories card to retry webhook registration.

Troubleshooting

“GitLab at … is already connected to this organization” Open the existing connection’s Configure → Groups tab to add another group on that host. A separate connection is not needed. If the group cannot be found, check the connected account’s membership and whether its service account is restricted to another top-level group. “The group or namespace was not found” Gitar could not read the group with the token you supplied. GitLab returns the same response whether the group does not exist or the token cannot see it, so check both:
  • The path is the group’s full path, including any parent groups. A subgroup is parent-group/subgroup, not subgroup.
  • The connected account is a member of that group or one of its parent groups. Creating a service account inside a group does not grant membership on its own.
“Group or project access tokens are not supported” Generate a PAT from the service account’s Manage access tokens page (preferred), or the dedicated user’s profile as a fallback. Tokens generated from group or project Access tokens settings are not accepted. No Service accounts menu If the GitLab edition or version has no Service accounts menu, use a dedicated regular user and generate its PAT.