From a75ffc5a81ff28782c6b13b2b90ee78f5bf586c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=94=E5=BF=B5?= <12574910+72wo@users.noreply.github.com> Date: Mon, 26 Jan 2026 23:48:02 +0800 Subject: [PATCH] =?UTF-8?q?```=20feat(.woodpecker):=20=E6=9B=B4=E6=96=B0SS?= =?UTF-8?q?H=E9=85=8D=E7=BD=AE=E4=BB=A5=E6=94=AF=E6=8C=81=E5=A4=9A?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0Git=E4=BB=93=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 更新了my-first-workflow.yaml文件中的SSH初始化步骤,将基础镜像从 alpine/git:latest更换为woodpeckerci/plugin-git,并调整了SSH密钥 存储路径以确保在不同环境下正确工作。现在SSH配置会同时创建 /root/.ssh和/app/.ssh目录,并将密钥文件放置在/app/.ssh目录下, 提高了与Woodpecker CI环境的兼容性。 ``` --- .woodpecker/my-first-workflow.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.woodpecker/my-first-workflow.yaml b/.woodpecker/my-first-workflow.yaml index 53eef9055..984072c54 100644 --- a/.woodpecker/my-first-workflow.yaml +++ b/.woodpecker/my-first-workflow.yaml @@ -22,19 +22,19 @@ clone: steps: # SSH初始化步骤 init-ssh: - image: alpine/git:latest + image: woodpeckerci/plugin-git environment: WOODPECKER_SSH_KEY: from_secret: WOODPECKER_SSH_KEY commands: - | # 设置SSH - mkdir -p ~/.ssh - echo "$${WOODPECKER_SSH_KEY}" > ~/.ssh/id_rsa - chmod 600 ~/.ssh/id_rsa - ssh-keyscan -H github.com >> ~/.ssh/known_hosts - ssh-keyscan -H bitbucket.org >> ~/.ssh/known_hosts - ssh-keyscan -H gitlab.com >> ~/.ssh/known_hosts + mkdir -p /root/.ssh /app/.ssh + echo "$${WOODPECKER_SSH_KEY}" > /app/.ssh/id_rsa + chmod 600 /app/.ssh/id_rsa + ssh-keyscan -H github.com >> /app/.ssh/known_hosts + ssh-keyscan -H bitbucket.org >> /app/.ssh/known_hosts + ssh-keyscan -H gitlab.com >> /app/.ssh/known_hosts # 配置git git config --global user.name "Woodpecker CI"