git-deployer
Deploy static site content to GitHub Pages or any git-backed host.
When to Use
- - GitHub Pages updates — You have a local build/output directory and want to push it to a
username.github.io repo or a Pages branch (gh-pages, main) - Static site deployment — Hugo, Jekyll, Gatsby, Docusaurus, or any static site with a git-hosted output
- Automated CI replacement — Instead of setting up GitHub Actions, you want a one-command deploy from your machine
- Syncing local → remote — You edit content locally and need to push changes to a hosted git repository
Workflow
CODEBLOCK0
- 1. Clone or init — If the remote repo exists, clone it to
/tmp/{reponame}. Otherwise initialize a fresh clone - Copy files — Sync your local site directory contents into the clone (clean copy, not append)
- Commit — Stage all files, commit with auto-generated timestamp message
- Force push — Push to remote with force flag to overwrite remote state
- Report — Output success/failure with commit hash and push result
Usage
Via skill invocation (from agent)
Provide the following arguments:
- -
site_path — Absolute path to the local site directory (the content to deploy) - INLINECODE5 — Full git URL (e.g.,
https://github.com/user/repo.git or git@github.com:user/repo.git) - INLINECODE8 — Branch to deploy to (default:
main)
Via script directly
CODEBLOCK1
Output
- - Success — Shows commit hash, remote URL, branch, and push status
- Failure — Shows error message with exit code and which step failed
Requirements
- -
git must be installed and configured with credentials for the remote - SSH key or HTTPS token auth must be set up for the remote repository
- Site path must exist and contain files
Notes
- - Uses
--force push — this will overwrite remote state. Use with caution on shared branches - Clone happens in
/tmp and is not cleaned up automatically (intentional: allows inspection) - Commit message format: INLINECODE13
git-deployer
将静态站点内容部署到 GitHub Pages 或任何基于 Git 的主机。
使用场景
- - GitHub Pages 更新 — 你有一个本地构建/输出目录,希望将其推送到 username.github.io 仓库或 Pages 分支(gh-pages、main)
- 静态站点部署 — Hugo、Jekyll、Gatsby、Docusaurus 或任何使用 Git 托管输出的静态站点
- 自动化 CI 替代方案 — 无需配置 GitHub Actions,只需一条命令即可从本地部署
- 本地 → 远程同步 — 你在本地编辑内容,需要将更改推送到托管的 Git 仓库
工作流程
本地站点目录 → /tmp/克隆 → 文件复制 → 提交 → 强制推送 → 完成
- 1. 克隆或初始化 — 如果远程仓库存在,则克隆到 /tmp/{仓库名}。否则初始化一个新的克隆
- 复制文件 — 将本地站点目录内容同步到克隆中(完全覆盖,而非追加)
- 提交 — 暂存所有文件,使用自动生成的时间戳消息提交
- 强制推送 — 使用强制标志推送到远程,覆盖远程状态
- 报告 — 输出成功/失败信息,包含提交哈希和推送结果
使用方法
通过技能调用(从代理)
提供以下参数:
- - sitepath — 本地站点目录的绝对路径(要部署的内容)
- remoteurl — 完整的 Git URL(例如 https://github.com/user/repo.git 或 git@github.com:user/repo.git)
- branch — 要部署的分支(默认:main)
直接通过脚本
bash
./scripts/deploy.sh /path/to/site git@github.com:user/repo.git [branch]
输出
- - 成功 — 显示提交哈希、远程 URL、分支和推送状态
- 失败 — 显示错误信息,包含退出代码和失败步骤
要求
- - 必须安装 git 并配置远程仓库的凭据
- 必须为远程仓库设置 SSH 密钥或 HTTPS 令牌认证
- 站点路径必须存在且包含文件
注意事项
- - 使用 --force 推送 — 这将覆盖远程状态。在共享分支上请谨慎使用
- 克隆操作在 /tmp 中执行,不会自动清理(有意为之:允许检查)
- 提交消息格式:Deploy: YYYY-MM-DD HH:MM:SS UTC