× press ESC to close

Netlify builds, deploys, and hosts your front end.

This feature is in beta.

Netlify’s Git Gateway connects your site to GitHub’s API, allowing tools like Netlify CMS to work with content, branches, and pull requests on your users’ behalf.

For a working example using Git Gateway with Netlify Identity service and Netlify CMS to let users edit site content without GitHub accounts or repository write privileges, try deploying this repository:

Deploy to Netlify

After clicking the Deploy to Netlify button above, you can follow the steps below to invite a user to the project. When that user clicks the link in the invitation email that follows, they’ll have access to edit site content with Netlify CMS, without a GitHub account or access to the repository.

That’s one example of something awesome that you can do with Git Gateway. To add Git Gateway to your existing web projects, check out the instructions below.

Getting Started

Note: Git Gateway requires HTTPS. If you’re using a custom domain, be sure to enable HTTPS before enabling Git Gateway on your site.

To get started using Git Gateway on a site, first enable Identity service, then go to Settings > Identity > Services > Git Gateway, and click Enable Git Gateway. This will automatically provision your site so that users have access to Git Gateway’s selected endpoints on your site’s connected GitHub repository.

null

You can change the settings as follows:

  • Repository: Not editable. Indicates which repository the Gateway will access (the site’s connected repository). Will not work (yet) with non-GitHub repositories.
  • Roles: Naming one or more roles in this field will limit Gateway access to users assigned a matching role (in individual user account data). Leaving this field blank will give access to all site users.
  • GitHub API access token: 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.

Using the Gateway

Once the Git Gateway is active, you can talk to GitHub’s API from your site via /.netlify/git/github . Requests will be scoped to the selected repository, so for a request like:

GET /.netlify/git/github/contents/

The Gateway will proxy an authenticated version of your request to the matching endpoint in GitHub’s API:

GET https://api.github.com/repos/your-user/your-repository/contents/

The Gateway limits access to the following sub endpoints of the repository:

/repos/:owner/:name/git/
/repos/:owner/:name/contents/
/repos/:owner/:name/pulls/
/repos/:owner/:name/branches/

Contact us if you have a use case that requires broader access.


Notice something is incorrect or outdated?

First off, great eye! We appreciate your discovery and want to ensure it gets addressed immediately. Please let us know here.

Want to get started quick?