Git sync

Connect a GitHub repo and turn the Markdown files in its docs folder into pages, synced on demand or on every push.

If your docs already live next to your code as Markdown, Git sync pulls them into your Dokly site. The repo is the source of truth: each .md or .mdx file in your docs folder becomes a page.

Connect a repo#

In your project's Settings → Git sync, fill in:

FieldDescription
Repositoryowner/name, e.g. acme/api-docs.
BranchLeave blank to use the repo's default branch.
Docs folderThe folder that holds your Markdown files, e.g. docs.
GitHub personal access tokenNeeds read access to the repo (public_repo is enough for a public repo). It's stored encrypted and never shown again.

Click Connect repository. Dokly checks the repo and token before saving.

The Git sync section with Repository, Branch, Docs folder and token fields and a Connect repository button

Sync#

Click Sync now. Dokly reads every .md and .mdx file under your docs folder and:

  • creates a page for each new file,
  • updates the page for each file that already synced,
  • deletes pages whose file is gone from the repo.

When it's done you see how many files were processed, created, updated and deleted, plus any files it couldn't read. Pages you created in the dashboard are never touched.

The repo wins

A synced page is overwritten on the next sync. Make changes in the repo, not in the Dokly editor, or they'll be lost.

Frontmatter#

Each file can set these fields in its frontmatter:

FieldDefault if missing
titleThe file's first # Heading, or its file name
slugThe file's path inside the docs folder, with slashes and other characters turned into hyphens: guides/setup.md becomes guides-setup. Set slug to keep slashes.
descriptionNone
publishedtrue. Set published: false to sync a file as a draft.
orderPlaced after pages that set an order
Markdown
---
title: Authentication
slug: guides/authentication
description: How to get and use an API key.
order: 2
---

Synced pages are added at the top level of your page tree.

Sync on every push (optional)#

To sync automatically, add a webhook in your GitHub repo under Settings → Webhooks → Add webhook. Copy the Payload URL and Secret from the Auto-sync on push panel in Git sync, set the content type to application/json, and choose Just the push event.

Only pushes to the branch you connected trigger a sync. If a push doesn't sync, GitHub's Recent Deliveries tab for the webhook shows what happened.

Draft docs from your repo with AI#

The Git sync section also has Draft docs from this repo. It reads your existing Markdown and uses AI to restructure it into new draft pages for you to edit. It costs 50 AI credits. The drafts are separate from synced pages.

Disconnect#

  • Disconnect (keep pages) stops syncing and leaves the synced pages in place.
  • Disconnect & delete synced pages also deletes every page that came from the repo. Pages you created in the dashboard aren't touched.

Where next#