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

Git Gateway + private repo #971

Closed
jryom opened this issue Dec 27, 2017 · 36 comments
Closed

Git Gateway + private repo #971

jryom opened this issue Dec 27, 2017 · 36 comments

Comments

@jryom
Copy link

jryom commented Dec 27, 2017

Hi,

Is it possible to use the Git Gateway with Netlify Identity to push changes to a private repo with the CMS?

@tech4him1
Copy link
Contributor

Yes, it is. Are you having problems getting it working?

@jryom
Copy link
Author

jryom commented Dec 29, 2017

Yes, it doesn't work for me unfortunately.

If I duplicate and deploy the gatsby-starter-netlify-cms repo and change the repository to private, all files disappear from the CMS. I can still sign in, but no files are visible. It works fine as long as the repo is public.

Would appreciate any help or tips. Thanks!

@tech4him1
Copy link
Contributor

tech4him1 commented Dec 29, 2017

After you change the repo to private, go into your Git Gateway settings in Netlify, and try re-issuing the token.

https://www.netlify.com/docs/git-gateway/#getting-started

@tech4him1 tech4him1 reopened this Dec 29, 2017
@jryom
Copy link
Author

jryom commented Dec 29, 2017

That did the trick, thanks a lot!

@MCDELTAT
Copy link

I just ran into this issue as well. Going to the Netlify Identify page and reissuing the token worked.

@tech4him1
Copy link
Contributor

@erquhart @verythorough I'm thinking we should document this. Maybe on Netlify.com, and then the CMS links to it?

@tech4him1 tech4him1 reopened this Mar 21, 2018
@erquhart
Copy link
Contributor

Agreed, it should definitely be documented. It used to be in the Netlify docs, but it seems to have been removed.

@mkozhukharenko
Copy link

After you change the repo to private, go into your Git Gateway settings in Netlify, and try re-issuing the token.

I did so, but I'm getting Cannot read property 'hasWriteAccess' of undefined error because of {domain}/.netlify/git/settings 404 (Not Found)

@tech4him1
Copy link
Contributor

@mkozhukharenko You often need to trigger a new deploy after you have made changes to the Git Gateway settings. If you try that and are still having problems, can you open a new issue?

@mkozhukharenko
Copy link

hm.. I didn't try.
I've delete whole netlify site and created from scratch. It helped

@amyrlam
Copy link
Contributor

amyrlam commented Sep 21, 2018

I have a Netlify site on a private GitHub repo. The private repo was recently transferred to new ownership on GitHub under me (still private).

I've reissued the Git Gateway with the one click feature and triggered a deploy. Try to log into my site at /admin and doesn't work - get Git Gateway Error: Please make sure Git Gateway is enabled on your site. (401 "Bad credentials")

I tried adding a GitHub Personal API token with full access (except delete repo!) into the Git Gateway and triggered a deploy. Same error.

I've emailed Netlify for help. Any debugging ideas?

One other thing - on Netlify, the owner is still the person with the original GitHub repo. But I'm an admin.

@amyrlam
Copy link
Contributor

amyrlam commented Sep 25, 2018

Emailed Netlify support. To fix #971 (comment), I had to re-link the repo to the site. This can be done from https://app.netlify.com/sites/<your_site>/settings/deploys. Thank you Netlify support!

@tech4him1
Copy link
Contributor

@amyrlam Sorry we missed this! If you can submit a pull request to add that to our docs, that would be great!

@amyrlam
Copy link
Contributor

amyrlam commented Sep 25, 2018

@tech4him1 sure I can take a stab at that, what is the repo? I just see the mailto here https://www.netlify.com/docs/git-gateway/.

@tech4him1
Copy link
Contributor

@verythorough
Copy link
Contributor

@amyrlam That would be awesome! The netlify.com docs repo is closed, so I just added a section there that you can link to from the netlifycms.org docs:
https://www.netlify.com/docs/git-gateway/#reconnect-after-changing-repository-permissions

In terms of where to add, I think maybe a similar sub-section at the end of the "Git Gateway with Netlify Identity" section of https://www.netlifycms.org/docs/authentication-backends/. What do you think?

@amyrlam
Copy link
Contributor

amyrlam commented Oct 2, 2018

@tech4him1 @verythorough Sorry for the delay!

Since I mentioned a note re: https://www.netlify.com/docs/git-gateway/#reconnect-after-changing-repository-permissions, I didn't rewrite the instructions in netlify-cms, but I can if that is preferred, let me know!

@verythorough
Copy link
Contributor

This is now documented thanks to @amyrlam in #1783. 🎉

@offre2010
Copy link

Please i need help here...
After setting up my CMS, i try to log into it, this is what i got (Your Git Gateway backend is not returning valid settings. Please make sure it is enabled.)...
Any way around this?

@erezrokah
Copy link
Contributor

Hi @offre2010, can you please open a new issue and follow the template?

@offre2010
Copy link

Good, thanks...

@timbomckay
Copy link

timbomckay commented Nov 22, 2020

I've been trying to debug this for a couple hours now. I happened to change the repo from private to public and I was suddenly able to access the CMS. I changed it back and was redirected to the login screen with API_ERROR: Not Found. I've tried reconnecting the repo multiple times, even though it was private to begin with, and I've generated a new access token multiple times. The only thing I haven't done is generate a personal access token in GitHub because I'm creating something for clients and want everything tied to the repo and not my profile.

Am I missing something or is this just not going to work without a personal access token?

Here's the config.yml backend settings btw:

backend:
  name: git-gateway
  branch: master

@talves
Copy link
Collaborator

talves commented Nov 22, 2020

Try resetting your Git Gateway access token under Identity/Services in the Netlify admin console under the site if you have not tried that yet.

Here are the docs: https://www.netlify.com/docs/git-gateway/

@timbomckay
Copy link

image

I've done this multiple times.

(Also had the wrong error message previously, it's giving API_ERROR: Not Found)

@talves
Copy link
Collaborator

talves commented Nov 22, 2020

The only thing I haven't done is generate a personal access token in GitHub because I'm creating something for clients and want everything tied to the repo

You have to create a new private token, I believe once you flip the repo to public. I think the token is not valid any longer.

@timbomckay
Copy link

A private token being a personal one and not one tied to the repo? I can't find a way to generate a repo specific token, when I follow the links it takes me to my github profile to generate a personal access token.

@talves
Copy link
Collaborator

talves commented Nov 22, 2020

Right. Needs to be created once you flip it back to private.

@timbomckay
Copy link

timbomckay commented Nov 22, 2020

Click the link to generate a token, or you may supply your own Personal Access Token. Be sure the token is generated for a user with sufficient permission on your linked repository to perform the actions you want to pass through the Gateway.

So "you may supply your own" should really say "a private repo requires a Personal Access Token"?

And the Generate access token in GitHub button in the Netlify admin is irrelevant when it's a private repo?

Am I understanding this correctly?

@talves
Copy link
Collaborator

talves commented Nov 22, 2020

I don't change my site from public to private often, so can't remember everything exactly. There is something about making sure you reconnect the repo.

https://docs.netlify.com/visitor-access/git-gateway/#reconnect-after-changing-repository-permissions

@timbomckay
Copy link

Yeah I've done that nearly every time as well. Guess I'll just have to keep it public.

@tomrutgers
Copy link
Contributor

Is the repo part of an organization account?

@timbomckay
Copy link

It is

@tomrutgers
Copy link
Contributor

Try this: #1703 (comment)

@talves
Copy link
Collaborator

talves commented Nov 23, 2020

Good recommend @tomrutgers . Forgot all about the organization rights.

@timbomckay
Copy link

Thanks for that. I'll check it out. I was wonder last night if that was a factor. haha. I'll get back to you.

@timbomckay
Copy link

Thanks for pointing me in the direction. This comment in #1816 worked for me. At least until I hand the repo over to a client, might have to just disable restrictions if I remove myself as a member for the org.

Thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests