Branch not found error on Netlify CMS login

Essentially my issue is described here:

I have regenerated my github api keys from the netlify control panel at https://app.netlify.com/sites/mysite/settings/identity#services multiple times and am still getting this error response when I click ‘Login with Netlify Identity’ from my CMS page:

GET: https://mysite.netlify.com/.netlify/git/github/branches/master?ts=1562846613232
404 Not Found

The response is from github’s api and seems to indicate that my branch was not found:

documentation_url: "https://developer.github.com/v3/repos/branches/#get-branch"
message: "Not Found"

The relevant portion of my config.yml is:

backend:
  name: git-gateway
  branch: master

It might be worth noting that the github repo I am working with belongs to an Organization, of which I am a fully-privileged member and is private. It was not deployed using the one-click deploy. Rather it is a next.js site and was deployed following the instructions here: https://www.netlifycms.org/docs/nextjs/

Again, I have tried multiple times with re-generating the github API keys to no avail, which leads me to suspect that this is a different issue.

I have almost the same Problem using Gatsby. Just to let you know so that you can check out my topic as well:

If you have any solution please let me know.

Regards
Leon

Hi Leon,

Yes i can confirm my issue is the same as yours. A user Cannot sign into the CMS using the netlify github auth gateway if the repo is private and belongs to an org (of which the user is the owner, with full permissions). Furthermore i can confirm that the Netlify github App permissions within the github organization are correct read/write.

I have found a workaround by deploying from a private personal repo. In this case the CMS works fine, indicating that this is not a user error.

I suggest we move all discussion of this issue to your ticket where I will re-post this comment.

I had the exact same problem and had to first approve the app for the organization on Github: https://help.github.com/en/articles/requesting-organization-approval-for-oauth-apps

1 Like