Create from GitHub
Create a Stackbit cloud project from existing GitHub repositories.
Stackbit supports the ability to create new cloud projects from an existing GitHub repository, or by duplicating a public repository.
Cloud projects are typically created when teams are ready to begin collaborating on visually editing a site.
If you don't think you're ready to create a cloud project, see the new project guide for suggestions on how to get started.
Cloud projects can only be created from valid Stackbit projects. A valid Stackbit project contains the following:
- Content: Content that is separated from code and structured.
- Configuration: A valid configuration file file.
- Framework/Runtime: A Node.js-based site framework using Node v14 or newer.
- Content Source: Proper API CMS configuration (if necessary). This depends on your content source and create mode.
When creating a new project, you can choose to connect to an existing GitHub repository, or Stackbit can duplicate an existing repository. This is done by clicking the Create from GitHub button on the new project screen.
Mode: Use My Repository
When using an existing repository, the Stackbit project will use the specified repository directly. This means that any changes made to the branch that content editors are using (
preview by default) will be reflected in the Stackbit project.
Configuring a Headless CMS
If your site is using a headless CMS as a content source (as defined in the Stackbit configuration file), you will be prompted to connect Stackbit to the relevant CMS and select an existing space/dataset/environment (the terminology depends on the CMS).
Mode: Duplicate a Repository
You also have the option to create a new project from any GitHub repository for which your GitHub user has read access. Stackbit duplicates that repository and creates a new cloud project based on the duplicated code.
Transferring Repository Ownership
When duplicating a repository, Stackbit pushes the duplicated code to a Stackbit-owned repository.
After the project is created, you can transfer the repository to a GitHub account or organization that you own. This will allow you to clone its contents to your local machine, push changes, modify branches, and so on.
You can later rename or move the repository as you wish and Stackbit will update automatically.
Importing Content into a Headless CMS
The repository you used to create a new project may be configured to use a headless CMS (via the
import configuration option).
For the creation process to work properly, your CMS account needs to be bootstrapped with the proper content model and initial content. After you connect Stackbit to your CMS account (when prompted), Stackbit creates creates and initializes a new space/dataset (to avoid content conflicts), then imports the data models and content.
To operate correctly with your repository, Stackbit needs the ability to commit and merge code, create branches and add a webhook. Because Stackbit operates on behalf of a GitHub user, your GitHub user must have admin-level permissions on the repository.
Setting-up a GitHub app is a two-step process, both of which should be completed when the install window pops up:
- Installation: This adds Stackbit application to your GitHub account, but doesn't configure the necessary permissions.
- Configuration: Provide the access mentioned above to the repository being used.
There are a number of advanced customizations you can make while creating a new cloud project.
Custom Git Branches
When creating a new project, Stackbit either infers or has sensible defaults for the Git branches it uses:
- Target Branch (production): Matches the repository's primary branch (usually
- Working Branch (development/editing): Defaults to
preview, and is automatically created for new projects when it doesn't exist.
You can make adjustments to these defaults as needed during the project creation process, or any time through the project settings. Learn more about Git branches in Stackbit.
Stackbit supports monorepo configurations — repositories that contain multiple Stackbit configuration files — through the site root directory option, which you can adjust after choosing a repository
Stackbit automatically validates repositories in Use my Repository mode. In this case, the first attempt at validation for monorepos typically fails because Stackbit validates against the root directory.
After you change the site root directory, you can click Revalidate to run the validation again. You won't be able to proceed without a valid site.
If you have a more complex monorepo layout and are unsure how to bring it into Stackbit, talk to us!
When duplicating a repository, your new project will come with managed hosting enabled by default. This makes it easy to evaluate starters and examples by being able to see the production publishing flow in action. You can disable managed hosting in the project settings.
In Use my Repository mode, managed hosting is disabled by default. Users choosing this option typically want more control over their deployment and hosting providers. You can however enable managed hosting at any time from the project settings.
Customers using a paid plan have an organization entity in Stackbit, through which permissions and projects are centrally managed. Organization admins have the option to place new projects within a specific organization.
Otherwise, new projects are automatically added to your personal account.