Git gateway and access to the repository

Hello, I have the following scenario:
a) Private repository exists on my Github account
b) It is later deployed to client’s Netlify account (authorized via Netlify API token) with identity enabled and client invited
c) Git Gateway created using my GitHub API access token in order to give client access to my repository via Netlify

As soon as client accepts the invite and logs in, Netlify identity widget (Netlify CMS actually) fails with error:
Problem fetching repo data from Git Gateway GitHubAPI.js:44:16
hasWriteAccess GitHubAPI.js:44
API_ERROR: “Not Found”
cms %5E2.0.0/dist/netlify-cms.js:63
cms %5E2.0.0/dist/netlify-cms.js:63
cms %5E2.0.0/dist/netlify-cms.js:505
cms %5E2.0.0/dist/netlify-cms.js:51
auth.js:111:14

A workaround that works: as soon as I add client’s Github account as a collaborator to my private repository, client can access my Github and use Netlify CMS.

I don’t understand why this happens and why the workaround works. Haven’t I already authorized client by prividing my GitHub API access token in client’s Git Gateway? How can I grant access (via Git Gateway) for a client who is not using Github at all?

Hi @JanosBongiorno and sorry for the late reply,
Just to confirm, you’ve configured this part:


with your own GitHub token generated from your account?
If so can you confirm that the token has repo scope:

Then could you verify the following command works (replace placeholder with correct values):

curl -H "Authorization: token <token>" "https://api.github.com/repos/<owner>/<repo>/branches/<branch>"

Also, can you confirm your configuration looks like this:

backend:
  name: git-gateway
  # this part is only required if default branch is not 'master'
  branch: <branch>

If that doesn’t work, can you try disabling git-gateway and re-enabling with a newly generated token?

I’m not sure as well why the workaround works, as git-gateway doesn’t use the authenticated user GitHub credentials to access the repo.