GitHub Push - Secure Auto-Push Tool
Automated GitHub push with:
- - Auto SSH Config: Auto-detect and load SSH keys
- Auto Remote Config: Auto-add git remote origin
- Auto Conflict Resolution: Auto pull + rebase + force
- Anti-Ban Mechanism: Rate limiting + commit batching + smart validation
Installation
No external dependencies required. Uses standard Git CLI (always available).
Usage Examples
CODEBLOCK0
Configuration
Create config.yaml for persistent settings:
CODEBLOCK1
Safety Thresholds
| Metric | Default | Description |
|---|
| Delay between ops | 3-5s | Randomized delay |
| Push cooldown |
180s | Min time between pushes |
| Max pushes/hour | 50 | Anti-spam limit |
| Max commits/hour | 100 | Anti-automation limit |
Troubleshooting
Error: "Too frequent pushes"
Solution: Wait at least 3 minutes before next push.
Error: "Repository not found"
Solution: Check repository exists and you have push access. Verify SSH key is added to GitHub.
Error: "Permission denied (publickey)"
Solution:
CODEBLOCK2
Error: "Merge conflict"
Solution: The script handles this automatically with pull + rebase + force. Check repository state if issue persists.
Error: "Validation failed"
Solution:
- - Check path exists and is accessible
- Verify files don't exceed 100MB (GitHub limit)
- Check for suspicious patterns (e.g., .env, id_rsa)
When Not to Use
- - Just viewing GitHub content
- Creating issues or PRs
- Code review
References
- -
references/ - Detailed config and API docs - INLINECODE3 - Full code examples
MIT License - OpenClaw Skill Standard
GitHub Push - 安全自动推送工具
自动化 GitHub 推送,具备以下功能:
- - 自动 SSH 配置:自动检测并加载 SSH 密钥
- 自动远程仓库配置:自动添加 git 远程源
- 自动冲突解决:自动拉取 + 变基 + 强制推送
- 反封禁机制:速率限制 + 提交批处理 + 智能验证
安装
无需外部依赖。使用标准 Git CLI(始终可用)。
使用示例
bash
快速推送(自动配置所有内容)
python3 scripts/github_upload.py --repo owner/repo --path ./files --message 更新
试运行测试(不实际推送)
python3 scripts/github_upload.py --repo owner/repo --path ./files --dry-run
强制推送(自动解决冲突)
python3 scripts/github_upload.py --repo owner/repo --path ./files --force
显示版本信息
python3 scripts/github_upload.py --version
配置
创建 config.yaml 以保存持久化设置:
yaml
defaults:
safe_mode: true
min_delay: 3 # 操作间隔(秒)
max_delay: 5 # 操作间隔(秒)
batch_commits: true
enable_validation: true
dry_run: false
safety:
maxcommitsper_hour: 100
maxpushesper_hour: 50
mintimebetween_pushes: 180 # 3分钟冷却时间
安全阈值
| 指标 | 默认值 | 描述 |
|---|
| 操作间隔 | 3-5秒 | 随机延迟 |
| 推送冷却时间 |
180秒 | 推送之间的最短时间 |
| 每小时最大推送次数 | 50 | 反垃圾邮件限制 |
| 每小时最大提交次数 | 100 | 反自动化限制 |
故障排除
错误:推送过于频繁
解决方案:等待至少3分钟后再进行下一次推送。
错误:未找到仓库
解决方案:检查仓库是否存在以及您是否拥有推送权限。验证 SSH 密钥是否已添加到 GitHub。
错误:权限被拒绝(公钥)
解决方案:
bash
加载 SSH 密钥
ssh-add ~/.ssh/id_ed25519
验证 SSH 连接
ssh -T git@github.com
错误:合并冲突
解决方案:脚本通过 拉取 + 变基 + 强制推送 自动处理此问题。如果问题持续存在,请检查仓库状态。
错误:验证失败
解决方案:
- - 检查路径是否存在且可访问
- 验证文件不超过 100MB(GitHub 限制)
- 检查是否存在可疑模式(例如 .env、id_rsa)
不适用场景
- - 仅查看 GitHub 内容
- 创建 Issue 或 PR
- 代码审查
参考
- - references/ - 详细配置和 API 文档
- scripts/ - 完整代码示例
MIT 许可证 - OpenClaw 技能标准