Deploy to Netlify
Netlify is the recommended hosting platform for GatsbyCar because it has built-in support for Decap CMS. This guide will walk you through deploying your website and setting up the CMS admin panel.
Why Netlify
Netlify is the best choice for GatsbyCar because:
- Built-in Git Gateway — Decap CMS authentication without extra setup
- Netlify Identity — free user management for CMS editors
- Automatic builds — every push to GitHub triggers a rebuild
- Free tier — 100 GB bandwidth and 300 build minutes per month
- Global CDN — fast loading worldwide
- HTTPS included — free SSL certificate
Step 1: Create a Netlify Account
- Open your browser and go to https://www.netlify.com
- Click Sign up in the top right
- Choose Sign up with GitHub
- Authorize Netlify to access your GitHub account
- Complete the onboarding
Step 2: Import Your Repository
- From the Netlify dashboard, click Add new site
- Click Import an existing project
- Click Deploy with GitHub
- Authorize Netlify if prompted
- Find and select your
gatsbycarrepository - Click it to select
Step 3: Configure Build Settings
Netlify will show build settings. Configure them as follows:
Branch to deploy
main(or your default branch)
Build command
npm run build
Publish directory
public
Environment variables (optional)
NODE_VERSION— set to18or20if build fails
Click Deploy site.
Step 4: Wait for the First Build
Netlify will start building your site. This takes 2 to 5 minutes.
You can watch the build progress. When complete, you will see:
Site is liveYour site is now available at a URL like:
https://random-name-12345.netlify.appStep 5: Change the Site Name
- Go to Site configuration → Site details
- Click Change site name
- Enter your preferred name, like
gatsbycar - Click Save
Your site is now at:
https://gatsbycar.netlify.appStep 6: Update Your Site URL
Open gatsby-config.js in VS Code.
Update siteUrl:
siteUrl: `https://gatsbycar.netlify.app/`,Commit and push:
git add .
git commit -m "Update site URL"
git pushNetlify will rebuild automatically.
Step 7: Enable Netlify Identity
Netlify Identity manages CMS admin users. It lets people log in to Decap CMS without having GitHub accounts.
- In Netlify dashboard, go to your site
- Click Integrations in the top menu
- Find Identity and click Enable Identity
- Go to Identity → Configuration and usage
Registration settings:
- Select Invite only (recommended)
- This means only people you invite can access the CMS
External providers (optional):
- Check GitHub if you want editors to log in with GitHub
- Check Google for Google login
Step 8: Enable Git Gateway
Git Gateway allows Decap CMS to read and write to your GitHub repository without giving editors direct GitHub access.
- In Netlify dashboard, go to Identity → Services
- Find Git Gateway
- Click Enable Git Gateway
- Leave the Roles field blank (allows all Identity users to access CMS)
Netlify will generate an API token automatically.
Step 9: Update config.yml for Production
Open static/admin/config.yml.
Make sure the backend section looks like this:
backend:
name: git-gateway
branch: mainImportant: If your repository default branch is master, change branch to master.
Do not add repo field — Git Gateway handles that automatically.
Commit and push:
git add .
git commit -m "Update Decap CMS config"
git pushStep 10: Invite Yourself as CMS User
- In Netlify dashboard, go to Identity
- Click Invite users
- Enter your email address
- Click Send
You will receive an email invitation. Click the link to set your password.
Step 11: Access the CMS Admin Panel
- Open your browser
- Go to https://gatsbycar.netlify.app/admin/
- You will see the Decap CMS login page
- Click Log in with Netlify Identity
- Enter your email and password
You are now in the CMS dashboard.
Step 12: Test CMS in Production
Let's verify everything works.
- Click Home Page in the sidebar
- Edit the Title field
- Click Save
- Click Publish
Netlify will detect the commit and rebuild your site. Wait 1 to 3 minutes.
Refresh your website. Your change should appear.
How the Production Workflow Works
When you save in Decap CMS (production mode):
- CMS commits changes to your GitHub repository via Git Gateway
- Netlify detects the new commit
- Netlify rebuilds your Gatsby site
- Changes go live on your domain
This happens automatically. You do not need to do anything manually.
Step 13: Add a Custom Domain (Optional)
- Go to Site configuration → Domain management
- Click Add a domain
- Enter your domain name, like
mycarrental.com - Follow Netlify's instructions to update your DNS
- Netlify will provision an SSL certificate automatically
Once set up, update siteUrl in gatsby-config.js to match your custom domain.
Common Issues and Solutions
Issue: Build fails with "Node version not supported"
Solution: Add an environment variable:
- Go to Site configuration → Environment variables
- Add
NODE_VERSIONwith value18or20 - Trigger a new deploy
Issue: "Your Git Gateway backend is not returning valid settings"
Solution: This means Git Gateway is not enabled or configured correctly.
- Go to Identity → Services
- Check that Git Gateway is enabled
- Check that
branchinconfig.ymlmatches your default branch (mainormaster)
Issue: CMS login page does not appear
Solution: Check that /admin/ route exists:
- Go to https://yoursite.netlify.app/admin/
- If 404, check that
static/admin/index.htmlexists - Check that
static/admin/config.ymlexists
Issue: "Cannot commit to repository"
Solution: Git Gateway token may have expired:
- Go to Identity → Services
- Click Git Gateway settings
- Regenerate the access token
- Save
Issue: Changes in CMS do not appear on site
Solution:
- Check Netlify dashboard → Deploys for build errors
- Wait a few minutes for rebuild
- Hard refresh browser with
Ctrl + Shift + R
Issue: Build succeeds but site shows 404
Solution: Check Publish directory:
- Go to Site configuration → Build & deploy
- Check that Publish directory is
public - Trigger a new deploy
Netlify Dashboard Overview
| Section | Purpose |
|---|---|
| Deploys | Build history and logs |
| Identity | Manage CMS users |
| Forms | Form submissions (if using Netlify Forms) |
| Functions | Serverless functions |
| Domain management | Custom domains and SSL |
Understanding the Deploy Process
Every time you push to GitHub, Netlify:
- Detects the new commit
- Runs
npm run build - Generates static files in
public/ - Deploys to global CDN
- Updates your live site
You can watch the progress in the Deploys tab.
Next Step
Your website is now live and the CMS is working. Proceed to:
Support and Custom Projects
Need Help?
If you get stuck, contact us:
- Email: creativebydre@gmail.com
- Custom project: https://www.fiverr.com/creativitas/create-your-custom-website-and-app
RentCar