← 返回 Skills 市场
164
总下载
0
收藏
2
当前安装
1
版本数
在 OpenClaw 中安装
/install auto-deploy
功能描述
Automates Git project deployment by pulling code, building, and deploying via SSH to Linux servers with backup and health checks.
使用说明 (SKILL.md)
自动化部署技能
描述
自动化 Git 项目部署技能。支持从私有 Git 仓库拉取代码、构建打包、SSH 部署到 Linux 服务器。
适用场景:
- 用户提出开发需求后自动开发并部署
- 代码修改后自动构建部署
- 多项目部署管理
前置条件
1. Git 访问配置
方式 A:HTTP 认证
# 配置 Git 凭据
git config --global credential.helper store
方式 B:SSH Key(推荐)
# 生成 SSH Key
ssh-keygen -t ed25519 -C "openclaw-deploy" -f ~/.ssh/openclaw_deploy
# 将公钥添加到 Git 服务器
cat ~/.ssh/openclaw_deploy.pub
2. 服务器 SSH 配置
# 生成部署 SSH Key(如果复用上面的可以跳过)
ssh-keygen -t ed25519 -C "server-deploy" -f ~/.ssh/server_deploy
# 将公钥添加到服务器
ssh-copy-id -i ~/.ssh/server_deploy.pub user@server_ip
3. 验证连接
# 测试 Git 连接
git ls-remote http://192.168.1.169:8015/peninsula/points
# 测试服务器连接
ssh -i ~/.ssh/server_deploy user@server_ip "echo connected"
工作流程
标准部署流程
1. 接收需求 → 2. 拉取代码 → 3. 开发修改 → 4. Git 提交
→ 5. 构建打包 → 6. SSH 传输 → 7. 服务器部署 → 8. 服务重启 → 9. 健康检查
详细步骤
步骤 1:拉取最新代码
cd /workspace/points
git pull origin main
步骤 2:开发修改
根据用户需求修改代码文件。
步骤 3:提交代码
git add .
git commit -m "feat: [需求描述]"
git push origin main
步骤 4:构建项目
Node.js 部分:
cd /workspace/points
npm install
npm run build
Java 部分:
cd /workspace/points/java-module
mvn clean package -DskipTests
步骤 5:打包部署产物
# 创建部署包
tar -czf points-deploy.tar.gz dist/ target/*.jar
步骤 6:SSH 传输到服务器
scp -i ~/.ssh/server_deploy points-deploy.tar.gz user@server:/tmp/
步骤 7:服务器部署
ssh -i ~/.ssh/server_deploy user@server \x3C\x3C 'EOF'
# 备份当前版本
cp -r /www/wwwroot/points /www/backup/points_$(date +%Y%m%d_%H%M%S)
# 解压新代码
tar -xzf /tmp/points-deploy.tar.gz -C /www/wwwroot/points
# 重启服务(根据实际服务管理方式)
# systemd:
systemctl restart points-service
# 或宝塔面板:
/etc/init.d/points restart
# 或 PM2(Node.js):
pm2 restart points
# 清理临时文件
rm /tmp/points-deploy.tar.gz
EOF
步骤 8:健康检查
ssh -i ~/.ssh/server_deploy user@server "curl -s http://localhost:端口/health || exit 1"
配置项
在 DEPLOY_CONFIG.md 中配置以下信息:
| 配置项 | 说明 | 示例 |
|---|---|---|
git.url |
Git 仓库地址 | http://192.168.1.169:8015/peninsula/points |
git.branch |
默认分支 | main |
server.host |
服务器 IP | 192.168.1.100 |
server.port |
SSH 端口 | 22 |
server.user |
SSH 用户 | root |
server.deployPath |
部署路径 | /www/wwwroot/points |
project.type |
项目类型 | nodejs / java / nodejs+java |
project.build.node.buildCmd |
Node 构建命令 | npm run build |
project.build.java.buildCmd |
Java 构建命令 | mvn clean package |
project.deploy.restartCmd |
重启命令 | pm2 restart points |
错误处理
Git 连接失败
- 检查网络连通性
- 验证认证信息
- 确认 SSH Key 已添加
SSH 连接失败
- 检查服务器 SSH 服务状态
- 验证 SSH Key 权限(
chmod 600 ~/.ssh/server_deploy) - 确认防火墙放行 SSH 端口
构建失败
- 检查 Node.js/Java 版本
- 确认依赖安装完整
- 查看详细错误日志
部署失败
- 检查部署目录权限
- 确认磁盘空间充足
- 回滚到备份版本
安全注意事项
-
敏感信息保护:
- 不要将密码、Token 写入配置文件
- 使用 SSH Key 代替密码认证
- SSH Key 设置权限
chmod 600
-
权限控制:
- 部署脚本需要 elevated 权限执行
- 限制可部署的服务器列表
- 敏感操作需要用户确认
-
备份策略:
- 每次部署前自动备份
- 保留最近 5 个版本
- 支持快速回滚
使用示例
简单需求(直接部署)
用户:帮我加个积分查询接口
1. 开发修改代码
2. 提交 Git
3. 自动构建部署
4. 回复用户:已完成部署 ✅
复杂需求(需要 Review)
用户:实现一个积分排行榜功能
1. 开发修改代码
2. 提交到 feature 分支
3. 回复用户:开发完成,请 Review
4. 用户确认后合并到 main 并部署
回滚流程
# 获取最新备份版本
BACKUP=$(ssh user@server "ls -t /www/backup/ | head -1")
# 恢复备份
ssh user@server \x3C\x3C EOF
systemctl stop points-service
rm -rf /www/wwwroot/points/*
cp -r /www/backup/$BACKUP/* /www/wwwroot/points/
systemctl start points-service
EOF
版本:1.0.0
最后更新:2026-03-26
安全使用建议
This skill appears to implement real deployment behavior but contains several red flags. Before installing or running it:
- Do not enable broad 'elevated' agent permissions until you audit the code. The README asks you to allow the agent to run git/ssh/scp/npm/mvn/tar which grants high capability.
- Inspect and remove any hardcoded credentials. The package includes plaintext usernames/passwords and a server IP (e.g., 'zhangjiamin' and 192.168.1.168). Treat those as leaked if they are real: rotate/change those passwords and keys on the remote systems immediately.
- Prefer SSH-key based authentication stored securely (not committed in files). Replace password-based expect/sshpass flows with key-based or vault-backed secrets.
- Avoid using root for deployment; use a dedicated, minimally privileged deploy user and restrict allowed commands on that account.
- Audit scripts that modify authorized_keys and those that print private data (show-ssh-config.js prints password). Remove any code that reveals secrets to logs or stdout.
- Run the skill only in a controlled/sandbox environment first (or on an isolated test server) to observe behavior. If you must use it in production, perform a full code review and sanitize deploy-config.json and other files, then apply principle of least privilege on the remote server.
If you need help hardening this package, consider asking the author for a version that uses: no embedded credentials, explicit support for secret stores or environment variables, key-based SSH only, and a non-root deploy user. Also request provenance (source/homepage) — currently the skill's source is unknown.
能力评估
Purpose & Capability
The skill's purpose (deploying code to Linux servers via SSH) aligns with the included scripts (deploy.sh, rollback.sh, install-server-env.sh, etc.). However metadata claims no required credentials or env vars while the shipped files embed sensitive information (Git HTTP username/password, server IP, root user, and a plaintext password). Embedding those credentials in the package is inconsistent with the declared 'no required env vars' and the SKILL.md security guidance, and is unnecessary for the stated purpose (SSH keys or external secret store would be expected).
Instruction Scope
SKILL.md and the scripts instruct the agent to perform broad actions: pull, modify, commit, push code; build (npm/mvn); run remote commands as root; backup/restore server directories; and create/modify SSH authorized_keys. Several scripts actively read/write local private/public key files and print or embed passwords (show-ssh-config.js prints the server password). The agent guidance also includes enabling elevated command execution in OpenClaw config — all of which expands the agent's reach beyond a minimal deploy helper and could allow arbitrary code changes and remote root operations.
Install Mechanism
There is no formal install spec (instruction-only), which reduces install-supply risk, but the repository includes many executable scripts that will be written to disk when the skill is installed and executed. install-server-env.sh uses network downloads (nodesource curl) to install Node.js — expected for server setup but worth noting because it fetches and runs remote installation scripts at runtime.
Credentials
The skill declares no required env vars or primary credential, yet the files contain explicit credentials: deploy-config.json and other files include git username/password (zhangjiamin) and server root credentials and IP (192.168.1.168). Scripts use hardcoded server password strings, expect/sshpass automation, and reference ~/.ssh/server_deploy. This mismatch (no declared secrets but hardcoded secrets present) is disproportionate and risky. The README also instructs enabling broad 'elevated' tool permissions for the agent, which increases the attack surface.
Persistence & Privilege
always is false and the skill is user-invocable (normal). However the README explicitly instructs granting the agent 'elevated' permissions (git, ssh, scp, npm, mvn, tar) in OpenClaw config. Granting those capabilities combined with the scripts' behavior (remote root operations and arbitrary builds) should be treated as high privilege and audited before enabling.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install auto-deploy - 安装完成后,直接呼叫该 Skill 的名称或使用
/auto-deploy触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
auto-deploy 1.0.0
- 首次发布:实现自动化部署 Git 项目至 Linux 服务器的完整流程
- 支持私有 Git 仓库代码拉取、构建(Node.js/Java)、SSH 上传、服务部署与重启
- 提供详细的使用说明、配置项表格与常见问题排查指引
- 包含安全建议、回滚策略和实际使用示例
元数据
常见问题
Auto Deploy 是什么?
Automates Git project deployment by pulling code, building, and deploying via SSH to Linux servers with backup and health checks. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 164 次。
如何安装 Auto Deploy?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install auto-deploy」即可一键安装,无需额外配置。
Auto Deploy 是免费的吗?
是的,Auto Deploy 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Auto Deploy 支持哪些平台?
Auto Deploy 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Auto Deploy?
由 zjm1226(@zjm1226)开发并维护,当前版本 v1.0.0。
推荐 Skills