Skip to content

Git Sync

Git Sync keeps Dagu workflows, documents, and markdown-backed agent files aligned with a Git repository.

What It Syncs

Git Sync can track:

  • DAG files
  • documents under docs/
  • agent memory
  • skills
  • souls

Tracked Items And IDs

Git Sync refers to each tracked file by an itemId. You will see that term in the CLI and REST API.

Local fileitemIdkind
my-dag.yamlmy-dagdag
subdir/report.ymlsubdir/reportdag
memory/MEMORY.mdmemory/MEMORYmemory
skills/review/SKILL.mdskills/review/SKILLskill
souls/persona.mdsouls/personasoul
docs/runbooks/deployment.mddocs/runbooks/deploymentdoc

Basic Configuration

yaml
git_sync:
  enabled: true
  repository: github.com/your-org/dags
  branch: main
  path: ""
  push_enabled: true

  auth:
    type: token
    token: ${GITHUB_TOKEN}

  auto_sync:
    enabled: true
    on_startup: true
    interval: 300

  commit:
    author_name: Dagu
    author_email: dagu@localhost

Authentication

HTTPS Token

yaml
git_sync:
  repository: github.com/your-org/dags
  auth:
    type: token
    token: ${GITHUB_TOKEN}

SSH Key

yaml
git_sync:
  repository: git@github.com:your-org/dags.git
  auth:
    type: ssh
    ssh_key_path: /home/user/.ssh/id_ed25519
    ssh_passphrase: ${SSH_PASSPHRASE}

Everyday Workflow

Most teams use Git Sync in this order:

  1. Check status
  2. Pull remote changes
  3. Review diffs
  4. Publish selected local changes
  5. Discard, forget, or clean up stale items when needed

Status Values

StatusMeaning
syncedLocal content matches the last synced revision
modifiedLocal content changed since the last sync
untrackedThe local file exists but has not been published yet
conflictBoth local and remote changed
missingA previously tracked local file is gone

CLI

Check Status

bash
dagu sync status

Pull

bash
dagu sync pull

Publish

bash
dagu sync publish my-dag -m "Update workflow"
dagu sync publish memory/MEMORY -m "Update memory"
dagu sync publish --all -m "Batch update"

Discard Local Changes

bash
dagu sync discard my-dag

Forget Stale State

bash
dagu sync forget missing-dag
dagu sync cleanup

Delete Or Move

bash
dagu sync delete my-dag -m "Remove old workflow"
dagu sync mv old-dag new-dag -m "Rename workflow"

REST API

MethodEndpointDescription
GET/api/v1/sync/statusOverall sync status and tracked items
POST/api/v1/sync/pullPull from the remote repository
POST/api/v1/sync/publish-allPublish selected or all changed items
POST/api/v1/sync/test-connectionVerify repository access
GET/api/v1/sync/configRead current Git Sync config
PUT/api/v1/sync/configUpdate Git Sync config
GET/api/v1/sync/items/{itemId}/diffShow local vs remote diff
POST/api/v1/sync/items/{itemId}/publishPublish one item
POST/api/v1/sync/items/{itemId}/discardDiscard one item
POST/api/v1/sync/items/{itemId}/forgetRemove stale sync state for one item
POST/api/v1/sync/items/{itemId}/deleteDelete one item locally and remotely
POST/api/v1/sync/items/{itemId}/moveRename one item
POST/api/v1/sync/delete-missingDelete all missing items from the remote
POST/api/v1/sync/cleanupRemove all missing entries from sync state

If an itemId contains /, URL-encode it in REST calls.

Permissions

ActionRequirement
View status and configAuthenticated access
Pull, publish, discard, delete, move, cleanuppermissions.write_dags plus a write-capable role
Update Git Sync configAdmin role

Write operations are blocked when Git Sync is configured as read-only (push_enabled: false).

Operational Notes

  • Manage Git Sync through the UI, CLI, or API rather than editing its internal state directly.
  • Pull before publishing when multiple people or systems may change the same repository.
  • Use clear commit messages because Git Sync publishes normal Git commits.

Released under the MIT License.