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 Netlify App 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: NextJS | Netlify CMS | Open-Source Content Management System

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: Requesting organization approval for OAuth Apps - GitHub Docs

2 Likes

Aha! That did it for me, too.

I didn’t know I was required to give Netlify Oauth access to the organization in addition to the repo. cc @fool maybe worth an update to the docs.

1 Like

Today we all learned :slight_smile: I’ll bring it up with the documentation team. Where would you have expected to see that in the docs? CMS docs or somewhere else?

1 Like

That worked. Thanks!

1 Like