dsh-git-sync

August 15, 2026 · View on GitHub

通过 Git 仓库同步 DeepSeek Harness 的配置、历史数据和提示词。

默认同步以下内容(可通过 include 调整):

  • settings.yaml — Harness 设置
  • AGENTS.md — 用户全局提示词/约定
  • skills/ — 自定义技能与提示词
  • sessions/ — 会话历史
  • storages/ — 本地存储数据
  • cordis.patch.yml — 用户级补丁配置
  • profiles/web/cordis.patch.ymlprofiles/web/package.json — Web profile 配置

不会同步 .credentials.yaml 等凭据文件。

安装

在插件源码目录执行:

dsh plugin --profile web add .

或从 GitHub 安装:

dsh plugin --profile web add github:shenmo7192/dsh-git-sync

配置

安装后可在 ~/.dsh/profiles/web/cordis.patch.yml 中覆盖插件配置:

- id: git-sync
  config:
    repository: https://gitee.com/shenmo7192/dsh-sync.git
    branch: main
    syncOnStart: true
    intervalMinutes: 60
    autoPull: true
    autoPush: true
    include:
      - settings.yaml
      - AGENTS.md
      - skills
      - sessions
      - storages
      - cordis.patch.yml
      - profiles/web/cordis.patch.yml
      - profiles/web/package.json
      - profiles/web/pnpm-lock.yaml
      - profiles/web/pnpm-workspace.yaml
      - profiles/web/cordis.yml
    ignore:
      - '**/node_modules/**'
      - '.credentials.yaml'

配置项

字段说明默认值
repositoryGit 仓库地址https://gitee.com/shenmo7192/dsh-sync.git
branch分支main
dshHomeDSH 主目录$DSH_HOME~/.dsh
localPath本地镜像仓库路径~/.dsh-git-sync
statePath同步状态文件路径~/.dsh-git-sync-state.json
syncOnStart启动时立即同步true
intervalMinutes定时同步间隔(分钟),0 表示不定时60
autoPull是否拉取远程更新true
autoPush是否推送本地更新true
include要同步的相对路径列表见上文
ignore忽略模式见上文
userNameGit 提交用户名shenmo
userEmailGit 提交邮箱shenmo@spark-app.store

工作原理

插件会在本机维护一个 Git 镜像仓库,默认位于 ~/.dsh-git-sync

  1. 确保镜像仓库存在并切换到指定分支;
  2. 读取本地同步状态(~/.dsh-git-sync-state.json);
  3. 首次在已有远程数据的设备上运行时,采用远程版本并应用到 DSH 主目录;
  4. 如果只有本地修改,则提交并推送到远程;
  5. 如果远程和本地都有修改,先把本地修改提交到镜像,再变基合并远程;若发生冲突则本次同步失败,需手动解决镜像仓库中的冲突;
  6. 将最终合并结果应用回 DSH 主目录;
  7. 如果开启了 autoInstall,自动在 ~/.dsh/profiles/* 下执行 pnpm install,下载并安装同步过来的插件依赖。

注意:当前版本是面向个人多设备同步的轻量实现。如果多台设备同时修改同一文件,Git 合并冲突会导致本次同步失败,请手动解决镜像仓库中的冲突后再同步。