woodpeckerci/plugin-git是Woodpecker CI的官方Git插件镜像,专为在CI/CD工作流中执行标准化Git操作而设计。该镜像封装了完整的Git工具链,提供从代码仓库克隆、分支检出到子模块管理的全流程支持,帮助开发者在自动化管道中高效获取源代码。
在Woodpecker CI配置文件(.woodpecker.yml)中添加以下步骤:
yamlsteps: - name: checkout code image: woodpeckerci/plugin-git settings: repo: https://github.com/your-username/your-repo.git branch: main depth: 1 submodule_update: true
| 参数名 | 类型 | 描述 | 默认值 |
|---|---|---|---|
| repo | string | Git仓库URL(HTTPS或SSH格式) | 无(必填) |
| branch | string | 要检出的分支名 | main |
| tag | string | 要检出的标签名(与branch二选一) | 无 |
| sha | string | 要检出的提交哈希(优先级最高) | 无 |
| depth | integer | 克隆深度,0表示完整克隆 | 50 |
| submodule_update | boolean | 是否更新子模块 | false |
| submodule_recursive | boolean | 是否递归更新子模块 | false |
| ssh_key | string | SSH私钥内容(用于SSH协议认证) | 无 |
| username | string | HTTPS认证用户名 | 无 |
| password | string | HTTPS认证密码 | 无 |
| skip_verify | boolean | 是否跳过SSL证书验证 | false |
SSH密钥认证配置
yamlsteps: - name: clone private repo image: woodpeckerci/plugin-git settings: repo: git@github.com:your-username/private-repo.git branch: develop ssh_key: from_secret: git_ssh_key # 引用Woodpecker CI密钥管理中的SSH密钥 submodule_update: true submodule_recursive: true
基于标签的版本检出
yamlsteps: - name: build release version image: woodpeckerci/plugin-git settings: repo: https://github.com/your-username/your-repo.git tag: v1.2.3 depth: 1 # 浅克隆加速获取
bashdocker run --rm \ -e PLUGIN_REPO=https://github.com/woodpecker-ci/plugin-git.git \ -e PLUGIN_BRANCH=main \ -e PLUGIN_DEPTH=10 \ woodpeckerci/plugin-git
除上述配置参数外,还可通过以下环境变量进行配置:
| 环境变量 | 对应配置参数 | 描述 |
|---|---|---|
| PLUGIN_REPO | repo | Git仓库URL |
| PLUGIN_BRANCH | branch | 分支名 |
| PLUGIN_TAG | tag | 标签名 |
| PLUGIN_SHA | sha | 提交哈希 |
| PLUGIN_DEPTH | depth | 克隆深度 |
| PLUGIN_SUBMODULE_UPDATE | submodule_update | 是否更新子模块 |

探索更多轩辕镜像的使用方法,找到最适合您系统的配置方式
通过 Docker 登录认证访问私有仓库
无需登录使用专属域名
Kubernetes 集群配置 Containerd
K3s 轻量级 Kubernetes 镜像加速
VS Code Dev Containers 配置
Podman 容器引擎配置
HPC 科学计算容器配置
ghcr、Quay、nvcr 等镜像仓库
Harbor Proxy Repository 对接专属域名
Portainer Registries 加速拉取
Nexus3 Docker Proxy 内网缓存
需要其他帮助?请查看我们的 常见问题Docker 镜像访问常见问题解答 或 提交工单
manifest unknown
no matching manifest(架构)
invalid tar header(解压)
TLS 证书失败
DNS 超时
410 Gone 排查
402 与流量用尽
401 认证失败
429 限流
D-Bus 凭证提示
413 与超大单层
来自真实用户的反馈,见证轩辕镜像的优质服务