Search code examples
jekyllnetlifynetlify-cms

How can I fix the 'sha' undefined error for my Netlify site?


So I've built a Jekyll site with the theme [Moon](Failed to persist entry: TypeError: Cannot read property 'sha' of undefined) and I've uploaded it to my GitHub repository. Then I want to add Netlify's admin panel to my site so I follow this guide which I modify the config.yml to the following code:

backend:
  name: git-gateway

publish_mode: editorial_workflow

media_folder: "files"

display_url: https://ccsource.org

slug:
  encoding: "ascii"
  clean_accents: true

collections:
  - name: "story"
    label: "Story"
    folder: "_posts"
    extension: "md"
    slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
    create: true
    fields:
      - {label: "Layout", name: "layout", widget: "hidden", default: "post"}
      - {label: "Title", name: "title", widget: "string"}
      - label: "tags"
        name: "tags"
        widget: "list"
        allow_add: true
        default: ["story"]
      - {label: "Summary", name: "excerpt", widget: "string", required: false}
      - {label: "comments", name: "comments", widget: "hidden", default: true}
      - label: "Publish date"
        name: "date"
        widget: "datetime"
        default: ""
        format: "MMM Do YY"
      - {label: "Body", name: "body", widget: "markdown", required: true}

Since I got markdown sample file like:

---
layout: post
title:  "Sample"
date:   2016-03-15
excerpt: "Hello..."
tag:
- sample
- post
- video
comments: true
---
# Sample

But after all things setup and deployed I visit my site's admin panel and try to create a new post I keep getting the following error.

Failed to persist entry: TypeError: Cannot read property 'sha' of undefined

And I've googled and modified the branch value to site which match to my github repository, but the error keeps showing, how can I fix it?


Solution

  • For anyone else experiencing this, the issue was that Netlify Identity was enabled, but Git Gateway, a sub-feature of Netlify Identity, was not. Instructions for enabling Git Gateway here: https://www.netlify.com/docs/git-gateway/#getting-started