There are two workflows for adding a new Gatsby Cloud site:
- Clone a Starter
- Import from a Git Repository
This lesson covers the "Import from a Git Repository" flow.
1. Prepare a Repository
For this lesson we will use the gatsby-starter-blog. Since this is a Gatsby starter, you can use Gatsby CLI to prepare this project on your machine.
gatsby new my-gatsby-project https://github.com/gatsbyjs/gatsby-starter-blog
Alternatively, you can clone the repository using Git.
git clone https://github.com/gatsbyjs/gatsby-starter-blog
After you have the project, push it to your remote GitHub repository.
2. Select Git Provider
From your Gatsby Cloud Dashboard, click the Add Site button.
In the Import from a Git repository card on the left hand side, choose your Git provider and install the Gatsby Cloud app. For the sake of this article we'll use GitHub, however GitLab and Bitbucket are also supported.
3. Specify Repository Details
Once connected to your Git provider, find the repository you would like to add to Gatsby Cloud and click Import.
Then provide the details for your site:
- The site name (defaults to
<repo name>-<branch name>)
- The branch to import from and set as your "production" branch in Gatsby Cloud (in this case, the
- The base directory, i.e., the directory containing the Gatsby site (the root directory,
/, is default)
After you enter the site details, click Next.
If the repository screen is stuck loading, reference this article for solutions.
4. Add Optional Integrations
Next you will be prompted to connect an optional content management system (CMS) to your site. This step will vary depending on the CMS provider, so there are separate tutorials for each supported CMS. However, for this specific example, you can scroll past this card to continue on.
5. Configure Environment Variables
Now, you will be asked to set up environmental variables for your site. The "Blog" starter does not use any environment variables so we will skip this step as well. Click Build site to continue.
Once your site is done building, you can view the site in two places:
Private Build URL
Use the build URL to preview the deployed site. This URL is not indexed and is only accessible via direct link.
Public Default Domain
Use your Gatsby Hosting provided default domain to access the public deployment of your site. Gatsby Hosting is turned on by default and the default domain is listed under Site Settings > Hosting.
Please sign in to leave a comment.