目录绑定

gstore进阶

目录绑定

把其他工具的配置目录加入同步。选择明确的小目录,不绑定整个 HOME、浏览器或智能体认证目录。

slothtool gstore bind mytool templates "/absolute/path/mytool-templates"
slothtool gstore list --json
slothtool gstore status mytool templates --json
slothtool gstore sync mytool templates -m "sync templates"

mytool 是分组,templates 是绑定名,最后的绝对路径替换为本机目录。目录不存在时会创建,因此先核对拼写,避免绑定到错误的空目录。

扫描普通文件和目录,跳过 .git、.DS_Store 和符号链接;不应用 pzip 的过滤规则。目录内容会进入 Git 历史,不适合直接同步正在写入的数据库或敏感认证材料。

第二台机器使用相同分组和名称,绑定自己的本地目录。gstore 自身配置不通过默认系统范围同步,所以需要重新创建绑定,并检查新目录已有内容后再拉取。

单绑定冲突策略的限制见解决同步冲突。创建绑定后,无绑定参数的 sync 会处理整个绑定集合,执行覆盖前重新 list 核对范围。

解除绑定:

slothtool gstore unbind mytool templates

只移除绑定及其同步基线,不删除本地目录、远端文件或 Git 历史;内置系统绑定不能这样移除。