首页龙虾技能列表 › Smart Git Backup — 技能工具

Smart Git Backup — 技能工具

v1.0.0

[自动翻译] Automates the backup of the OpenClaw workspace to a remote Git repository. Handles large file exclusions, validates git configuration, and performs in...

2· 754·3 当前·3 累计
by @vemec·MIT-0
下载技能包
License
MIT-0
最后更新
2026/2/26
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
high confidence
The skill's requirements and behavior are coherent with a Git-based workspace backup tool, but it automatically stages and pushes all files (and mutates .gitignore), so you should review and constrain its use before running it in a repo that may contain secrets.
评估建议
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 .gitigno...
详细分析 ▾
用途与能力
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.
指令范围
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.
安装机制
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.
凭证需求
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'.
持久化与权限
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.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv1.0.02026/2/13

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.

● 无害

安装命令 点击复制

官方npx clawhub@latest install memory-git-sync
镜像加速npx clawhub@latest install memory-git-sync --registry https://cn.clawhub-mirror.com

技能文档

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

  • Validates Git repository, user config, and remote access
  • Detects & excludes large files (>95MB) to prevent push failures
  • Stages all changes automatically
  • Pulls latest remote changes to avoid conflicts
  • Commits changes with timestamped or custom message
  • 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

StepActionSuccess OutputFailure OutputExit
1Validate Git repo[SUCCESS] Git repository found[ERROR] Not inside a git repository1
2Check Git config[SUCCESS] Git user configuration is valid[ERROR] Git user.name not configured1
3Check remote[SUCCESS] Remote 'origin' configured: [URL][ERROR] No 'origin' remote1
4Setup .gitignore[SUCCESS] Gitignore file is ready--
5Scan large files[SUCCESS] No large files detected[WARNING] Large files detected-
6Detect changes[SUCCESS] All changes staged[INFO] No uncommitted changes0
7Fetch remote[SUCCESS] Successfully fetched[WARNING] Fetch failed (continues)-
8Check sync[INFO] Local and remote synchronized[WARNING] Branches diverged (auto-pull)1
9Commit[SUCCESS] Changes committed[ERROR] Commit failed1
10Push[SUCCESS] Successfully pushed[WARNING] No upstream (tries to set)1
DoneComplete[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

IssueOutputResolution
Not in a Git repo[ERROR] Not inside a git repositoryNavigate to repo: cd /path/to/repo
Missing user.name[ERROR] Git user.name not configuredgit config user.name "Name"
Missing user.email[ERROR] Git user.email not configuredgit config user.email "email@example.com"
No origin remote[ERROR] No 'origin' remote configuredgit remote add origin
Large files detected[WARNING] Large files detectedAutomatically added to .gitignore
Pull conflicts[ERROR] Pull encountered conflictsResolve manually, then run sync again
Network failures[WARNING] Fetch/Push failedCheck 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
数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务