7

I am trying to use this Gatsby starter with Netlify CMS. https://github.com/stackrole-dev/gatsby-starter-foundation

I followed the instructions exactly but after enabling Git Gateway, when I try to login in as admin I encountered this error massage.

Your Git Gateway backend is not returning valid settings. Please make sure it is enabled.

I have no ideas why it is not working.

My config.yml is

backend:
  name: git-gateway
  commit_messages:
    create: 'Create {{collection}} “{{slug}}”'
    update: 'Update {{collection}} “{{slug}}”'
    delete: 'Delete {{collection}} “{{slug}}”'
    uploadMedia: '[skip ci] Upload “{{path}}”'
    deleteMedia: '[skip ci] Delete “{{path}}”'

local_backend: true # run npx netlify-cms-proxy-server for local testing

media_folder: "static/assets" 
public_folder: "/assets" 

collections:
Joji
  • 4,703
  • 7
  • 41
  • 86

3 Answers3

6

You need to enable your settings for git-gateway and external providers in your Netlify as shown in Netlify documentation:

git-gateway

This configuration can be found under https://app.netlify.com/sites/YOURNAME/settings/identity

In addition, your config.yml lacks:

backend:
  name: git-gateway
  repo: username/repository
  branch: master

Note: change username and repository for your names.

Ferran Buireu
  • 28,630
  • 6
  • 39
  • 67
  • Hi thanks for the reply! I went back and set my external provider as Github but it still shows this error. I also enabled the git Gateway – Joji Jun 04 '20 at 20:32
  • Can you provide a piece of your `config.yml`? – Ferran Buireu Jun 04 '20 at 20:33
  • Sure I edited my question to include the config file – Joji Jun 04 '20 at 20:35
  • 1
    Thanks @Joji! You didn't mention that it was a `local_backend`. Did you try running `npx netlify-cms-proxy-server` and then try to login? – Ferran Buireu Jun 04 '20 at 20:40
  • Thanks for the reply. I am pretty illiterate on these topics. The instructions on the git repo says after setting up the git gateway we can access the admin via site-name.netlify.app/admin/. So is this how I should access the CMS? i.e. using localhost/admiin and push to the git repo whenever I done editing? – Joji Jun 04 '20 at 20:53
  • Ideally, yes. You are missing some parameters in your `config.yml` that are updated in my answer. In addition, the way you described sets a local server when you run the command. If you are not using it, I would recommend to remove it since it's a beta feature. – Ferran Buireu Jun 04 '20 at 21:23
  • 1
    Thanks for the reply! What is the best practice here in your opinion? should I access CMS using the live site link like `site-name.netlify.app/admin/` or accessing it via local server? – Joji Jun 04 '20 at 21:39
  • Accessing locally removes the "issue" of pulling and rebasing all the time your local environment to fetch all the new data published in the site, however, in this case, being a beta (unstable) feature, I would remove it temporarily in order to solve your question issue. When your issue will be solved, you can try it locally. – Ferran Buireu Jun 04 '20 at 21:45
  • Thanks for the reply. Last question: you mentioned that I should add `repo: username/repository` in `backend`. Is the `username` my github username and the `repository` the url to my git repo? For example, if the repo is, https://github.com/stackrole/gatsby-starter-foundation, the `repo: username/repository` would be: `repo: stackrole/gatsby-starter-foundation`? – Joji Jun 04 '20 at 22:25
  • 1
    Yes, it's the slug of the repository. In your case would be: `repo: stackrole/gatsby-starter-foundation` – Ferran Buireu Jun 05 '20 at 04:55
4

You can enable git-gateway

Settings > Identity > Services

enter image description here

Artem Arkhipov
  • 7,025
  • 5
  • 30
  • 52
ufukcam
  • 93
  • 6
1

I faced the same issue while configuring Netlify CMS. I faced this issue because I was passing master branch in Netlify CMS config but in GitHub repo my branch was main.My issue was resolved by changing branch config.yaml