Problem with configuring Netlify CMS with Git Gateway
Asked Answered
C

4

8

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:
Chamade answered 4/6, 2020 at 20:18 Comment(0)
C
7

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.

Cimah answered 4/6, 2020 at 20:23 Comment(10)
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 GatewayChamade
Can you provide a piece of your config.yml?Cimah
Sure I edited my question to include the config fileChamade
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?Cimah
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?Chamade
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.Cimah
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?Chamade
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.Cimah
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, github.com/stackrole/gatsby-starter-foundation, the repo: username/repository would be: repo: stackrole/gatsby-starter-foundation?Chamade
Yes, it's the slug of the repository. In your case would be: repo: stackrole/gatsby-starter-foundationCimah
M
4

You can enable git-gateway

Settings > Identity > Services

enter image description here

Muttra answered 1/9, 2020 at 0:0 Comment(0)
A
2

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

Andromede answered 19/3, 2023 at 13:4 Comment(0)
F
0

I solved this issue by disabling the git gateway and enabling it again.

  • Go to Site configuration
  • Then navigate to services, it is under the Identity section

Netlify settings page

  • Click on disable git gateway and enable it once again

enter image description here

  • Then try to log into your Netlify CMS it should work.
Flatus answered 8/7 at 23:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.