- 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:
- 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, selectapi
. - GitLab gives you an Application ID. Copy this ID and enter it in your Static CMS
config
file, along with the following settings:
Name 17356_dd1c51-8d> |
Type 17356_2c4e28-4f> |
Default 17356_13b691-cf> |
Description 17356_37a3e7-f0> |
---|---|---|---|
auth_type 17356_1c6639-35> |
‘pkce’ 17356_88c34e-d2> | 17356_cbedb3-8b> |
The authorization method 17356_fb8496-f5> |
app_id 17356_7e2fee-38> |
string 17356_700625-ff> | 17356_847cec-de> |
Application ID from your GitLab settings 17356_6b1fdb-2a> |
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
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:
Name 17356_022288-21> |
Type 17356_671041-3d> |
Default 17356_a645b3-5d> |
Description 17356_8724e7-85> |
---|---|---|---|
api_root 17356_0c3ed1-db> |
string 17356_ee41f0-45> | 17356_8689a4-95> |
Root API url for self-hosted instance 17356_da8b24-ca> |
base_url 17356_ef7c05-62> |
string 17356_bddef8-e4> | 17356_ce9fb9-3c> |
Root url for self-hosted instance 17356_f6b93d-54> |
auth_endpoint 17356_bfda3f-0c> |
string 17356_2b0cb1-2a> | 17356_33f7b4-f4> |
Auth endpoint on self-hosted instance 17356_de7fb3-60> |
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
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.