Setup Git-Based Blog
This guide shows you how to connect a Git repository for blog content. It assumes you’re comfortable with Git and version control.
Prerequisites
Section titled “Prerequisites”- Git repository (GitHub, GitLab, Bitbucket, or self-hosted)
- Repository containing MDX files in a
posts/directory - Access credentials (SSH key or access token for private repos)
Repository Structure
Section titled “Repository Structure”Your repository should follow this layout:
your-repo/├── posts/ # MDX blog posts│ ├── post-1.mdx│ └── post-2.mdx└── assets/ └── images/ # Post imagesConfigure in Admin
Section titled “Configure in Admin”Basic Settings
Section titled “Basic Settings”-
Git Repository URL — Enter your repository URL
- HTTPS:
https://github.com/your-org/blog-content.git - SSH:
git@github.com:your-org/blog-content.git
- HTTPS:
-
Branch — Specify the branch to sync from (usually
main) -
Content Path — Directory containing posts (default:
posts) -
Enable Content Sync — Toggle on to enable automatic syncing during builds
Authentication
Section titled “Authentication”No authentication needed. Use the HTTPS URL and leave authentication fields empty.
For private repositories using HTTPS:
-
Generate a token with read access:
- GitHub: Settings → Developer settings → Personal access tokens → Fine-grained tokens
- GitLab: Preferences → Access Tokens
- Bitbucket: Personal settings → App passwords
-
Paste the token in the Access Token field
-
Select Access Token as the authentication method
For SSH authentication:
-
Generate a deploy key:
Terminal window ssh-keygen -t ed25519 -C "blog-content-deploy" -f ~/.ssh/blog_deploy -
Add the public key (
blog_deploy.pub) to your repository as a deploy key:- GitHub: Repo Settings → Deploy keys → Add deploy key (read-only)
- GitLab: Repo Settings → Repository → Deploy keys
- Bitbucket: Repo Settings → Access keys
-
Paste the private key contents into the SSH Private Key field
-
Select SSH Key as the authentication method
Test the Connection
Section titled “Test the Connection”-
Click Save to store your configuration
-
Click Sync Now to test the connection
-
Check the sync status:
- Success: Shows last synced time and commit hash
- Error: Review error message and fix authentication/URL issues
Sync Behavior
Section titled “Sync Behavior”Content syncs at these times:
- Manual: Click “Sync Now” in the admin panel
- Automatic: During each site build/deploy
- Scheduled: Daily sync (if enabled in platform settings)
Troubleshooting
Section titled “Troubleshooting”Authentication Failed
Section titled “Authentication Failed”- Verify token/key has read access
- Check if token has expired
- Confirm repository URL is correct
- For SSH, ensure private key matches public key added to repo
Branch Not Found
Section titled “Branch Not Found”- Confirm branch name exists (check for
mainvsmaster) - Verify spelling and case sensitivity
No Posts Found
Section titled “No Posts Found”- Ensure MDX files are in the configured content path
- Verify files have
.mdxextension (not.md) - Check frontmatter syntax is valid YAML
Invalid Frontmatter
Section titled “Invalid Frontmatter”Posts must have:
titlefielddatefield in YYYY-MM-DD format
Optional but recommended:
descriptionfor SEOauthorfor attributionimagefor featured imagetagsfor categorization
Best Practices
Section titled “Best Practices”Use meaningful commit messages — Help your team understand content changes
Test in staging branch — Preview changes before publishing to main
Optimize images before committing — Compress to < 200KB for faster loading
Regular syncs — Manually sync after pushing changes to see them reflected quickly
Monitor sync status — Check the admin panel for warnings about missing frontmatter or sync errors