-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Update docs to add Bitbucket support #1512
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,15 +7,15 @@ menu: | |
--- | ||
# Authentication & Backends | ||
|
||
Netlify CMS stores content in your GitHub or GitLab repository. (Bitbucket [coming soon](https://github.com/netlify/netlify-cms/pull/525)!) In order for this to work, you need to authenticate with your Git host, and in most cases that requires a server. We have a few options for handling this. | ||
Netlify CMS stores content in your GitHub, GitLab, or Bitbucket repository. In order for this to work, you need to authenticate with your Git host, and in most cases that requires a server. We have a few options for handling this. | ||
|
||
**Note:** some static site generators have plugins for optimized integration with Netlify CMS, and starter templates may utilize these plugins. If you're using a starter template, read the template documentation before proceeding, as their instructions may differ. | ||
|
||
## Git Gateway with Netlify Identity | ||
|
||
[Git Gateway](https://github.com/netlify/git-gateway) is a Netlify open source project that allows you to add editors to your site CMS without giving them direct push access to your GitHub or GitLab repository. [Netlify Identity](https://www.netlify.com/docs/identity/) service can handle the authentication and provides a simple interface for user management. The Netlify CMS [featured templates](https://www.netlifycms.org/docs/start-with-a-template) are working examples of this backend. | ||
[Git Gateway](https://github.com/netlify/git-gateway) is a Netlify open source project that allows you to add editors to your site CMS without giving them direct write access to your GitHub or GitLab repository. (For Bitbucket repositories, use the [Bitbucket backend](#bitbucket-backend) instead.) [Netlify Identity](https://www.netlify.com/docs/identity/) service can handle the authentication and provides a simple interface for user management. The Netlify CMS [featured templates](https://www.netlifycms.org/docs/start-with-a-template) are working examples of this backend. | ||
|
||
To use it in your own project, follow these steps: | ||
To use it in your own project stored on GitHub or GitLab, follow these steps: | ||
|
||
1. Head over to the [Netlify Identity docs](https://www.netlify.com/docs/identity) and follow the | ||
steps to get started. | ||
|
@@ -56,14 +56,16 @@ To enable it: | |
```yaml | ||
backend: | ||
name: github | ||
repo: owner-name/repo-name # Path to your Github repository | ||
repo: owner-name/repo-name # Path to your GitHub repository | ||
``` | ||
|
||
If you prefer to run your own authentication server, check out the section on [external OAuth clients](#external-oauth-clients). | ||
|
||
## GitLab Backend | ||
|
||
For repositories stored on GitLab, the `gitlab` backend allows CMS users to log in directly with their GitLab account. Note that all users must have push access to your content repository for this to work. | ||
|
||
Unlike GitHub, the GitLab API allows for two types of OAuth2 flows: [Web Application Flow](https://docs.gitlab.com/ce/api/oauth2.html#web-application-flow), which works much like the GitHub OAuth flow described above, and [Implicit Grant](https://docs.gitlab.com/ce/api/oauth2.html#implicit-grant), which operates _without_ the need for an authentication server. | ||
The GitLab API allows for two types of OAuth2 flows: [Web Application Flow](https://docs.gitlab.com/ce/api/oauth2.html#web-application-flow), which works much like the GitHub OAuth flow described above, and [Implicit Grant](https://docs.gitlab.com/ce/api/oauth2.html#implicit-grant), which operates _without_ the need for an authentication server. | ||
|
||
### Web Application Flow with Netlify | ||
|
||
|
@@ -112,14 +114,21 @@ With GitLab's Implicit Grant, users can authenticate with GitLab directly from t | |
|
||
Note that in both cases, GitLab will also provide you with a client secret. You should _never_ store this in your repo or reveal it in the client. | ||
|
||
## Bitbucket Support | ||
## Bitbucket Backend | ||
|
||
For repositories stored on Bitbucket, the `bitbucket` backend allows CMS users to log in directly with their Bitbucket account. Note that all users must have write access to your content repository for this to work. | ||
|
||
Netlify CMS is meant to be platform agnostic, so we’re always looking to expand the ecosystem and | ||
find new ways to use it. Check out our active PR in progress for | ||
[Bitbucket](https://github.com/netlify/netlify-cms/pull/525) backend support. | ||
To enable it: | ||
|
||
1. Follow the authentication provider setup steps in the [Netlify | ||
docs](https://www.netlify.com/docs/authentication-providers/#using-an-authentication-provider). | ||
2. Add the following lines to your Netlify CMS `config.yml` file: | ||
|
||
Git Gateway could also be modified to support other Git hosts. If you're interested, you can file an | ||
issue (or a pull request!) in the [git-gateway repo](https://github.com/netlify/git-gateway). | ||
```yaml | ||
backend: | ||
name: bitbucket | ||
repo: owner-name/repo-name # Path to your Bitbucket repository | ||
``` | ||
|
||
## External OAuth Clients | ||
|
||
|
@@ -137,16 +146,14 @@ Check each project's documentation for instructions on how to configure it. | |
|
||
## Options | ||
|
||
The `git-gateway`, `github`, and `gitlab` backends all allow some additional optional fields for certain use | ||
cases. A full reference is below. Note that these are properties of the `backend` field, and should | ||
be nested under that field. | ||
Netlify CMS backends allow some additional fields for certain use cases. A full reference is below. Note that these are properties of the `backend` field, and should be nested under that field. | ||
|
||
| Field | Default | Description | | ||
| --------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `repo` | none | **Required** for `github` and `gitlab` backends; ignored by `git-gateway`. Follows the pattern `[org-or-username]/[repo-name]`. | | ||
| `repo` | none | **Required** for `github`, `gitlab`, and `bitbucket` backends; ignored by `git-gateway`. Follows the pattern `[org-or-username]/[repo-name]`. | | ||
| `accept_roles` | none | `git-gateway` only. Limits CMS access to your defined array of user roles. Omitting this field gives access to all registered users. | | ||
| `branch` | `master` | The branch where published content is stored. All CMS commits and PRs are made to this branch. | | ||
| `api_root` | `https://api.github.com` (GitHub) or `https://gitlab.com/api/v4` (GitLab) | The API endpoint. Only necessary in certain cases, like with GitHub Enterprise or self-hosted GitLab. | | ||
| `api_root` | `https://api.github.com` (GitHub), `https://gitlab.com/api/v4` (GitLab), or `https://api.bitbucket.org/2.0` (Bitbucket) | The API endpoint. Only necessary in certain cases, like with GitHub Enterprise or self-hosted GitLab. | | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I kept the Bitbucket mentions in the defaults, but removed any mention of self-hosted Bitbucket. |
||
| `site_domain` | `location.hostname` (or `cms.netlify.com` when on `localhost`) | Sets the `site_id` query param sent to the API endpoint. Non-Netlify auth setups will often need to set this for local development to work properly. | | ||
| `base_url` | `https://api.netlify.com` (GitHub) or `https://gitlab.com` (GitLab) | OAuth client URL. **Required** when using an external OAuth server or self-hosted GitLab. | | ||
| `auth_endpoint` | `auth` (GitHub) or `oauth/authorize` (GitLab) | Path to append to `base_url` for authentication requests. Optional. | | ||
| `base_url` | `https://api.netlify.com` (GitHub, Bitbucket) or `https://gitlab.com` (GitLab) | OAuth client URL. **Required** when using an external OAuth server or self-hosted GitLab. | | ||
| `auth_endpoint` | `auth` (GitHub, Bitbucket) or `oauth/authorize` (GitLab) | Path to append to `base_url` for authentication requests. Optional. | |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,6 +23,7 @@ Netlify CMS can be [added to an existing site](https://www.netlifycms.org/docs/a | |
|
||
After clicking one of those buttons, you’ll authenticate with GitHub or GitLab and choose a repository name. Netlify will then automatically create a clone of the repository in your GitHub or GitLab account. Next, it will build and deploy the new site on Netlify, bringing you to the site dashboard when the build is complete. | ||
|
||
**Note for Bitbucket users:** Netlify CMS supports Bitbucket repositories, but Bitbucket's permissions won't work with the Deploy to Netlify buttons above. You can still set up a repository manually, or follow the [tutorial](https://www.netlifycms.org/docs/add-to-your-site) for adding Netlify CMS to an existing site. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me know if you think this should be worded differently. As an aside, it would probably make a nice addition to the Netlify CMS blog to write a tutorial for setting up a Bitbucket site from a template. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added an issue for the tutorial: https://github.com/netlify/netlify-cms/issues/1513 |
||
|
||
## Access Netlify CMS on your new site | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need confirmation that these steps/settings are correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Benaiah confirmed. I removed the part about setting up your own auth server.