返回顶部
g

git-sync-daemonGit同步守护

>

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
265
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

git-sync-daemon

Git 同步守护进程

目的

提供一个可复用的、基于守护进程的 Git 自动同步工作流:

  • - 一个仓库列表文件
  • 一个守护进程
  • 每个仓库独立锁定,故障隔离互不影响
  • 支持 macOS 和 Linux 上的服务管理

文件

  • - 引擎:scripts/gitsyncdaemon.sh
  • 控制 CLI:scripts/gitsyncctl.sh

默认运行时路径

  • - 状态目录:~/.config/git-sync-daemon
  • 仓库列表:~/.config/git-sync-daemon/repos.conf
  • 日志文件:~/.config/git-sync-daemon/git-sync-daemon.log

仓库条目格式

每行一个仓库:

text
/absolute/path/to/repo|remote=origin|branch=main|enabled=1

支持的键:

  • - remote(默认 origin)
  • branch(默认当前分支)
  • enabled(1/0,true/false,默认启用)

快速开始(macOS)

bash
bash scripts/gitsyncctl.sh init
bash scripts/gitsyncctl.sh add-repo /Users/samwei12/Develop/config
bash scripts/gitsyncctl.sh run-once
bash scripts/gitsyncctl.sh install-launchd
bash scripts/gitsyncctl.sh status

快速开始(Linux)

bash
bash scripts/gitsyncctl.sh init
bash scripts/gitsyncctl.sh add-repo /path/to/repo
bash scripts/gitsyncctl.sh run-once
sudo bash scripts/gitsyncctl.sh install-systemd
bash scripts/gitsyncctl.sh status

操作

  • - 添加仓库:bash scripts/gitsyncctl.sh add-repo <路径> [分支] [远程]
  • 移除仓库:bash scripts/gitsyncctl.sh remove-repo <路径>
  • 列出仓库:bash scripts/gitsyncctl.sh list-repos
  • 立即执行一次同步:bash scripts/gitsyncctl.sh run-once
  • 查看状态/日志尾部:bash scripts/gitsyncctl.sh status

服务生命周期:

  • - macOS 安装:bash scripts/gitsyncctl.sh install-launchd
  • macOS 卸载:bash scripts/gitsyncctl.sh uninstall-launchd
  • Linux 安装:sudo bash scripts/gitsyncctl.sh install-systemd
  • Linux 卸载:sudo bash scripts/gitsyncctl.sh uninstall-systemd

生产环境加固检查清单

在生产环境启用守护进程模式前:

  1. 1. SSH/认证基线
  • - 确保服务用户能够通过 SSH 对每个远程仓库执行非交互式 Git 操作。
  • 预加载主机密钥(ssh-keyscan / StrictHostKeyChecking=accept-new),避免首次运行失败。
  • 建议在 ~/.ssh/config 中显式配置密钥路由(host/user/port/IdentityFile/IdentitiesOnly)。
  1. 2. 服务身份一致性
  • - 使用与仓库凭据和 Git 配置相同的用户安装服务。
  • 验证该服务用户的 git config --global user.name/user.email。
  1. 3. 仓库注册策略
  • - 仅注册干净、预期的仓库。
  • 每个仓库条目保持一个规范分支;避免分离 HEAD 目标。
  • 临时暂停时使用 enabled=0,而非删除行。
  1. 4. 可观测性
  • - 将日志保存在专用文件中,必要时进行外部轮转。
  • 在启用持久化服务前,先验证 run-once 是否正常。

安全注意事项

  • - 守护进程不会强制推送。
  • 变基冲突会被记录并隔离到受影响的仓库。
  • 如果钩子需要 git-lfs 但缺失,该仓库将被跳过并记录显式错误日志。
  • 在 macOS launchd 中,PATH 会在服务环境和守护进程脚本中扩展,以包含 Homebrew 二进制文件。
  • 推荐的迁移实践:首次成功运行应仅使用基线仓库;然后逐步添加更多仓库。

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 git-sync-daemon-1776204996 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 git-sync-daemon-1776204996 技能

通过命令行安装

skillhub install git-sync-daemon-1776204996

下载

⬇ 下载 git-sync-daemon v1.0.0(免费)

文件大小: 6.99 KB | 发布时间: 2026-4-15 10:56

v1.0.0 最新 2026-4-15 10:56
Initial release: multi-repo daemon sync with ctl workflow, systemd/launchd lifecycle, and production hardening guidance

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部