Static CMS
Star StaticJsCMS/static-cms on GitHub
v4.3.0DocsExamplesDemoCommunity

GitLab

  • Name: gitlab

For repositories stored on GitLab, the gitlab backend allows CMS users to log in directly with their GitLab account. Note that all users must have push access to your content repository for this to work.

Note: GitLab default branch is protected by default, thus typically requires maintainer permissions in order for users to have push access.

Authentication

With GitLab's PKCE authorization, users can authenticate with GitLab directly from the client. To do this:

  1. Follow the GitLab docs to add your Static CMS instance as an OAuth application and uncheck the Confidential checkbox. For the Redirect URI, enter the address where you access Static CMS, for example, https://www.mysite.com/admin/. For scope, select api.
  2. GitLab gives you an Application ID. Copy this ID and enter it in your Static CMS config file, along with the following settings:
NameTypeDefaultDescription
auth_type'pkce'The authorization method
app_idstringApplication ID from your GitLab settings

Example

backend:
  name: gitlab
  repo: owner-name/repo-name # Path to your GitLab repository
  auth_type: pkce # Required for pkce
  app_id: your-app-id # Application ID from your GitLab settings

Self-Hosted GitLab Instance

You can also use PKCE Authorization with a self-hosted GitLab instance. This requires adding api_root, base_url, and auth_endpoint fields:

NameTypeDefaultDescription
api_rootstringRoot API url for self-hosted instance
base_urlstringRoot url for self-hosted instance
auth_endpointstringAuth endpoint on self-hosted instance

Example

backend:
  name: gitlab
  repo: owner-name/repo-name # Path to your GitLab repository
  auth_type: pkce # Required for pkce
  app_id: your-app-id # Application ID from your GitLab settings
  api_root: https://my-hosted-gitlab-instance.com/api/v4
  base_url: https://my-hosted-gitlab-instance.com
  auth_endpoint: oauth/authorize

Git Large File Storage (LFS)

The GitLab backend does support git-lfs.