8

I have a Gatsby static site that is currently deployed via Zeit Now from a self-hosted Gitlab account.

I would like to add Netlify CMS, but it only seems to integrate with a Gitlab.com account.

Is it possible to use Netlify CMS with a self-hosted Gitlab account?

Undistraction
  • 42,754
  • 56
  • 195
  • 331

2 Answers2

17

You will be able to use Netlify CMS with a self-hosted Gitlab server using Implicit Grant

As the docs show, your options are below for the backend in the config.yml file:

backend:
  name: gitlab
  repo: owner-name/repo-name # Path to your GitLab repository
  auth_type: implicit # Required for implicit grant
  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

On Gitlab: Setup an application on Gitlab to get the app_id and to set the Redirect URI, enter the address where you access Netlify CMS, for example, https://www.example.com/admin/. For scope, select api

Update: It is recommended to use client-side PKCE Authorization now for Gitlab rather than Implicit Grant.

talves
  • 13,993
  • 5
  • 40
  • 63
  • I've made an update to this answer for those looking to use Auth for Gitlab with Netlify CMS. PKCE is going to be a more secure solution. – talves Jun 08 '21 at 16:04
0

By using Netlify CLI you set it up to auto-deploy from Self-hosted/managed GitLab.

You'll need to configure SSH key and webhook integration. Here is a detailed guide: Auto Deploy to Netlify from Self-hosted GitLab

Gijo Varghese
  • 11,264
  • 22
  • 73
  • 122
  • 3
    The OP wants to use Netlify CMS, not Netlify (which is a different thing, it's a hosting service) Netlify CLI works only with Netlify. – Spoderman4 Jan 13 '21 at 14:49