For what differs between this platform and the others, see Platform Support.
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
GitLab service account (recommended)
GitLab service account (recommended)
- Go to your group in GitLab
- On the left sidebar, select Settings → Service accounts
- Select Add service account
- Enter a name and username, then select Create
gitar-service-acme.A service account is the preferred option: unlike a regular user, it does not occupy a seat on your GitLab instance, and its token keeps working even if the person who set it up leaves.Project service accounts are limited to their project. Subgroup service accounts are limited to that subgroup and its descendants. A top-level group service account or instance service account can have broader invitation scope, subject to GitLab version and SSO restrictions. Check GitLab’s service-account guidance before choosing an account for multiple groups.
Dedicated user (fallback), including Community Edition
Dedicated user (fallback), including Community Edition
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.
- Open the account’s access token page
- Select Add new token
- Enter a token name and set an expiration date. Note this date so you can rotate the token before it expires
- Select the
apiscope, then select Generate token - Copy the token immediately, as GitLab will not show it again
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:
- Go to that group in GitLab
- On the left sidebar, select Manage → Members
- Select Invite members
- Search for the account, assign the Maintainer or Owner role, then select Invite
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.
acmefor gitlab.com/acme, oracme/platformfor a subgroup - Project ID (Optional): Find your project ID in GitLab project settings
- Personal Access Token: The token you generated above, with the
apiscope
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.- Open Settings → Configuration → Connections and select Configure for the existing GitLab connection.
- Keep the default Groups tab selected.
- Search for the top-level group’s full path, such as
acme, and select the matching group. - Review the project preview, then select Onboard N projects. Gitar includes projects in subgroups such as
acme/platformandacme/mobile, subject to the connected account’s permissions.
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.- Open Settings → Configuration → Connections and select Configure for the GitLab connection.
- Open the Auto-connect tab and enable Automatically connect projects.
- Search for a group under Add groups.
- Select Add beside the group. Repeat for each group to watch.
- To watch only a group itself, clear Include subgroups for that group.
- Select Save changes.
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 forpending 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 usesnoreply@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, notsubgroup. - 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.