Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken Netlify CMS due to Github master branch name change to "main" #4417

Closed
jsl15c opened this issue Oct 5, 2020 · 7 comments
Closed

Broken Netlify CMS due to Github master branch name change to "main" #4417

jsl15c opened this issue Oct 5, 2020 · 7 comments
Labels
area: docs type: bug code to address defects in shipped code

Comments

@jsl15c
Copy link

jsl15c commented Oct 5, 2020

When a branch is not specified in config.yml, Netlify defaults to using master branch of repo. Due to recent name change of master branch to main , this creates an API_ERROR: cannot find branch in CMS when publishing entries and 404 errors on initial CMS load.

To Reproduce

  1. Create a new repo and project utilizing Netlify CMS, netlify-cms-app . I used gatsby.js for my project.
  2. Setup config.yml in project without specifying branch name under:
backend:
  name: github
  repo: org/repo
  1. Publish a new entry in Netlify CMS

Expected behavior
Initial load of localhost:8000/admin results in 404 (that are handled well). Main problem is introduced when publishing CMS entries. API_ERROR occurs.

Applicable Versions:

  • Netlify CMS version: 2.12.25
  • Git provider: Github
  • Node.JS version: 13.13.0

CMS configuration

backend:
  name: github
  repo: jsl15c/repo
media_folder: static/assets
public_folder: /static
collections:
  - name: Product
    label: Product
    folder: product
    create: true
    fields:
      - { name: name, label: Name }
      - { label: Description, name: description, widget: text }
      - { label: Price, name: price, widget: number }
@jsl15c jsl15c added the type: bug code to address defects in shipped code label Oct 5, 2020
@tomrutgers
Copy link
Contributor

You'll have to set a branch manually if you want to use something else than master:

backend:
  name: github
  repo: org/repo
  branch: main

@jsl15c
Copy link
Author

jsl15c commented Oct 5, 2020

@tomrutgers I realize that, but I figured it may be good to add logic to handle this change in Githubs default naming conventions

@tomrutgers
Copy link
Contributor

I see, thanks for clarifying!

@stephlocke
Copy link
Contributor

Could this be added to the default github config code block in the docs? 🙏 I appreciate the available options are outlined in the account settings overview but with main being the default branch name in github now, many people who go straight to the github How To will end up with errors.

@erezrokah
Copy link
Contributor

Hi @stephlocke, would you mind submitting a PR for it? You can do it by clicking edit this page here https://www.netlifycms.org/docs/github-backend/

@stephlocke
Copy link
Contributor

👍 #5264

@martinjagodic
Copy link
Member

Closing as stale and/or outdated.

@martinjagodic martinjagodic closed this as not planned Won't fix, can't repro, duplicate, stale May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docs type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

5 participants