3.6 KiB
3.6 KiB
GitHub Integration Setup for Quartz Sync
Quick Setup Guide
1. Create GitHub Personal Access Token
- Go to: https://github.com/settings/tokens
- Click "Generate new token" → "Generate new token (classic)"
- Configure:
- Note: "Canvas Website Quartz Sync"
- Expiration: 90 days (or your preference)
- Scopes:
- ✅
repo(Full control of private repositories) - ✅
workflow(Update GitHub Action workflows)
- ✅
- Click "Generate token" and copy it immediately
2. Set Up Your Quartz Repository
For the Jeff-Emmett/quartz repository, you can either:
Option A: Use the existing Jeff-Emmett/quartz repository
- Fork the repository to your GitHub account
- Clone your fork locally
- Set up the environment variables to point to your fork
Option B: Create a new Quartz repository
# Create a new Quartz site
git clone https://github.com/jackyzha0/quartz.git your-quartz-site
cd your-quartz-site
npm install
npx quartz create
# Push to GitHub
git add .
git commit -m "Initial Quartz setup"
git remote add origin https://github.com/your-username/your-quartz-repo.git
git push -u origin main
3. Configure Environment Variables
Create a .env.local file in your project root:
# GitHub Integration for Quartz Sync
NEXT_PUBLIC_GITHUB_TOKEN=your_github_token_here
NEXT_PUBLIC_QUARTZ_REPO=Jeff-Emmett/quartz
NEXT_PUBLIC_QUARTZ_BRANCH=main
4. Enable GitHub Pages
- Go to your repository → Settings → Pages
- Source: "GitHub Actions"
- This will automatically deploy your Quartz site when you push changes
5. Test the Integration
- Start your development server:
npm run dev - Import some Obsidian notes or create new ones
- Edit a note and click "Sync Updates"
- Check your GitHub repository - you should see new/updated files in the
content/directory - Your Quartz site should automatically rebuild and show the changes
How It Works
-
When you sync a note:
- The system creates/updates a Markdown file in your GitHub repository
- File is placed in the
content/directory with proper frontmatter - GitHub Actions automatically rebuilds and deploys your Quartz site
-
File structure in your repository:
your-quartz-repo/ ├── content/ │ ├── note-1.md │ ├── note-2.md │ └── ... ├── .github/workflows/ │ └── quartz-sync.yml └── ... -
Automatic deployment:
- Changes trigger GitHub Actions workflow
- Quartz site rebuilds automatically
- Changes appear on your live site within minutes
Troubleshooting
Common Issues
-
"GitHub API error: 401 Unauthorized"
- Check your GitHub token is correct
- Verify the token has
repopermissions
-
"Repository not found"
- Check the repository name format:
username/repo-name - Ensure the repository exists and is accessible
- Check the repository name format:
-
"Sync successful but no changes on site"
- Check GitHub Actions tab for workflow status
- Verify GitHub Pages is enabled
- Wait a few minutes for the build to complete
Debug Mode
Check the browser console for detailed sync logs:
- Look for "✅ Successfully synced to Quartz!" messages
- Check for any error messages in red
Security Notes
- Never commit your
.env.localfile to version control - Use fine-grained tokens with minimal required permissions
- Regularly rotate your GitHub tokens
Next Steps
Once set up, you can:
- Edit notes directly in the canvas
- Sync changes to your Quartz site
- Share your live Quartz site with others
- Use GitHub's version control for your notes