使用自托管 Gitlab 的 Netlify CMS

Netlify CMS with self-hosted Gitlab

我有一个 Gatsby 静态站点,目前是通过 Zeit Now 从自托管 Gitlab 帐户部署的。

我想补充Netlify CMS, but it only seems to integrate with a Gitlab.com account

是否可以通过自托管 Gitlab 帐户使用 Netlify CMS?

您将能够使用 Netlify CMS 和自托管 Gitlab 服务器 using Implicit Grant

如文档所示,config.yml 文件中 backend 的选项如下:

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

在 Gitlab 上: 设置一个 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/。对于范围,select api

更新: Gitlab 推荐使用 client-side PKCE Authorization 而不是隐式授权。

通过使用 Netlify CLI,您可以将其设置为从 Self-hosted/managed GitLab 自动部署。

您需要配置 SSH 密钥webhook 集成。这里有一个详细的指南:Auto Deploy to Netlify from Self-hosted GitLab