Prerequisites:

  1. Navigate to Project > Integrations and select the Secret Syncs tab. Click on the Add Sync button.

  2. Select the GitLab option.

  3. Configure the Source from where secrets should be retrieved, then click Next.

    • Environment: The project environment to retrieve secrets from.
    • Secret Path: The folder path to retrieve secrets from.

If you need to sync secrets from multiple folder locations, check out secret imports.

  1. Configure the Destination to where secrets should be deployed, then click Next.

    • GitLab Connection: The GitLab Connection to authenticate with.
    • Scope: The GitLab scope to sync secrets to.
      • Project: Sync secrets to a GitLab project.
      • Group: Sync secrets to a GitLab group.

    The remaining fields are determined by the selected Scope:

    Be aware that GitLab only allows to mark secrets as hidden for new secrets. If you try to mark an existing secret as hidden, it produces an error.

    If you enable Mark secrets as Hidden, Infisical will not be able to unhide/unmask secrets from the sync destination if you disable the option later. This is because GitLab does not allow to unhide/unmask existing secrets.

  2. Configure the Sync Options to specify how secrets should be synced, then click Next.

    • Initial Sync Behavior: Determines how Infisical should resolve the initial sync.
      • Overwrite Destination Secrets: Removes any secrets at the destination endpoint not present in Infisical.

      GitLab does not support importing secrets.

    • Key Schema: Template that determines how secret names are transformed when syncing, using {{secretKey}} as a placeholder for the original secret name and {{environment}} for the environment.

    We highly recommend using a Key Schema to ensure that Infisical only manages the specific keys you intend, keeping everything else untouched.

    • Auto-Sync Enabled: If enabled, secrets will automatically be synced from the source location when changes occur. Disable to enforce manual syncing only.
    • Disable Secret Deletion: If enabled, Infisical will not remove secrets from the sync destination. Enable this option if you intend to manage some secrets manually outside of Infisical.
  3. Configure the Details of your GitLab Sync, then click Next.

    • Name: The name of your sync. Must be slug-friendly.
    • Description: An optional description for your sync.
  4. Review your GitLab Sync configuration, then click Create Sync.

  5. If enabled, your GitLab Sync will begin syncing your secrets to the destination endpoint.