← 返回 Skills 市场
vemec

Smart Git Backup

作者 vemec · GitHub ↗ · v1.0.0
cross-platform ✓ 安全检测通过
799
总下载
2
收藏
3
当前安装
1
版本数
在 OpenClaw 中安装
/install memory-git-sync
功能描述
Automates the backup of the OpenClaw workspace to a remote Git repository. Handles large file exclusions, validates git configuration, and performs intelligent sync with conflict resolution.
使用说明 (SKILL.md)

Memory Sync Skill

Automates Git synchronization and backup of workspace memory to a remote repository.

Quick Start

bash ./scripts/sync.sh [COMMIT_MESSAGE]

Default message: chore: memory backup YYYY-MM-DD HH:MM

What It Does

  1. Validates Git repository, user config, and remote access
  2. Detects & excludes large files (>95MB) to prevent push failures
  3. Stages all changes automatically
  4. Pulls latest remote changes to avoid conflicts
  5. Commits changes with timestamped or custom message
  6. Pushes to remote, setting upstream if needed

Prerequisites

✓ Git repository initialized with origin remote ✓ git config user.name and git config user.email set ✓ Network access to remote repository ✓ Write permissions on repository directory

Execution Steps

Step Action Success Output Failure Output Exit
1 Validate Git repo [SUCCESS] Git repository found [ERROR] Not inside a git repository 1
2 Check Git config [SUCCESS] Git user configuration is valid [ERROR] Git user.name not configured 1
3 Check remote [SUCCESS] Remote 'origin' configured: [URL] [ERROR] No 'origin' remote 1
4 Setup .gitignore [SUCCESS] Gitignore file is ready - -
5 Scan large files [SUCCESS] No large files detected [WARNING] Large files detected -
6 Detect changes [SUCCESS] All changes staged [INFO] No uncommitted changes 0
7 Fetch remote [SUCCESS] Successfully fetched [WARNING] Fetch failed (continues) -
8 Check sync [INFO] Local and remote synchronized [WARNING] Branches diverged (auto-pull) 1*
9 Commit [SUCCESS] Changes committed [ERROR] Commit failed 1
10 Push [SUCCESS] Successfully pushed [WARNING] No upstream (tries to set) 1**
Done Complete [SUCCESS] Sync completed - 0

*Auto-resolves with git pull --no-edit **Auto-sets upstream with git push --set-upstream origin [branch]

Output Format

All messages use structured prefixes for LLM parsing:

[INFO]    - Informational messages
[SUCCESS] - Actions completed successfully
[WARNING] - Non-fatal issues (script recovers)
[ERROR]   - Fatal errors (requires intervention)

Common Scenarios

Issue Output Resolution
Not in a Git repo [ERROR] Not inside a git repository Navigate to repo: cd /path/to/repo
Missing user.name [ERROR] Git user.name not configured git config user.name "Name"
Missing user.email [ERROR] Git user.email not configured git config user.email "[email protected]"
No origin remote [ERROR] No 'origin' remote configured git remote add origin \x3CURL>
Large files detected [WARNING] Large files detected Automatically added to .gitignore
Pull conflicts [ERROR] Pull encountered conflicts Resolve manually, then run sync again
Network failures [WARNING] Fetch/Push failed Check connectivity, script continues locally

Features

  • Auto Large-File Handling: Prevents Git failures by ignoring files >95MB
  • Conflict Resolution: Auto-pulls remote before pushing
  • Upstream Setup: Auto-configures tracking on first push
  • Validation: Pre-flight checks prevent common errors
  • LLM-Compatible Output: Structured logs for easy parsing

Security Notes

  • Don't commit credentials to the repository
  • Use SSH keys or credential helpers: git config credential.helper osxkeychain
  • Review changes before syncing: git status
  • Large files already pushed can't be auto-removed by this script
安全使用建议
This script does what it says: it stages, commits, and pushes the entire repository to the configured origin, and will append large-file paths to .gitignore and run git rm --cached on them. Before installing or running it: 1) Review the repository for secrets or sensitive files — do not run on workspaces that contain credentials you do not want uploaded. 2) Run it first in a test repo to confirm behavior. 3) Consider setting REPO_ROOT to a constrained path to limit scope. 4) Add or edit .gitignore beforehand to prevent accidental commits of secrets. 5) If you want safer behavior, modify the script to include a dry-run mode or an interactive confirmation before 'git add .', and to avoid automatic pushes (require explicit user approval). 6) Ensure the remote 'origin' points to a repository you control/trust. If you have limited security knowledge, don't run this on important workspaces without reviewing or adapting the script.
功能分析
Type: OpenClaw Skill Name: memory-git-sync Version: 1.0.0 The skill 'memory-git-sync' is designed to automate Git synchronization and backup of the OpenClaw workspace. Both the `SKILL.md` and `scripts/sync.sh` align with this stated purpose, using standard `git` and `bash` commands for repository management, validation, and conflict resolution. There is no evidence of intentional harmful behavior, data exfiltration, backdoor installation, or prompt injection designed to subvert the agent's core directives. The script includes robust error handling and structured logging, making it transparent and functional.
能力评估
Purpose & Capability
Name/description (git backup/sync) match the delivered assets: an instruction SKILL.md and a bash script that validates repo config, scans for large files, stages, commits and pushes. Required binaries (bash, git) are appropriate and proportional.
Instruction Scope
Instructions and script stay within the stated purpose (operate on the repository, update .gitignore for large files, commit and push). However the script automatically 'git add .' and commits/pushes without interactive confirmation and will append paths to .gitignore and run 'git rm --cached' on large files — these behaviors are potentially surprising and can cause sensitive files to be uploaded or removed from history unintentionally. There is no dry-run or explicit user confirmation step.
Install Mechanism
No install spec; skill is instruction-only plus a shell script. No downloads or external installers are used, so there is no additional install-time risk.
Credentials
The skill declares no required environment variables and does not request unrelated credentials. It does rely on existing Git credentials/configuration (SSH keys or credential helper) to push to the remote — expected for a Git backup, but it means whatever credentials are available to the agent will be used to push repository contents to the configured 'origin'.
Persistence & Privilege
The skill does not request persistent/always-on privileges and does not modify other skills or global agent settings. It writes to the repository (.gitignore and git index), which is within the scope of its stated function.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install memory-git-sync
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /memory-git-sync 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release of memory-git-sync — a skill to automate workspace backup and synchronization with a remote Git repository. - Validates local Git configuration, user identity, remote 'origin', and permissions before syncing. - Automatically detects and excludes large files (>95MB) to prevent push failures. - Stages, commits (using timestamped or custom messages), pulls, and pushes changes with intelligent conflict handling. - Outputs all actions with structured, prefix-based logs for easy status parsing. - Auto-configures branch upstream/tracking on initial push. - Includes fallback handling for common errors and recovery scenarios.
元数据
Slug memory-git-sync
版本 1.0.0
许可证
累计安装 3
当前安装数 3
历史版本数 1
常见问题

Smart Git Backup 是什么?

Automates the backup of the OpenClaw workspace to a remote Git repository. Handles large file exclusions, validates git configuration, and performs intelligent sync with conflict resolution. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 799 次。

如何安装 Smart Git Backup?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install memory-git-sync」即可一键安装,无需额外配置。

Smart Git Backup 是免费的吗?

是的,Smart Git Backup 完全免费(开源免费),可自由下载、安装和使用。

Smart Git Backup 支持哪些平台?

Smart Git Backup 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Smart Git Backup?

由 vemec(@vemec)开发并维护,当前版本 v1.0.0。

💬 留言讨论