```
feat(.woodpecker): 更新SSH配置以支持多平台Git仓库 更新了my-first-workflow.yaml文件中的SSH初始化步骤,将基础镜像从 alpine/git:latest更换为woodpeckerci/plugin-git,并调整了SSH密钥 存储路径以确保在不同环境下正确工作。现在SSH配置会同时创建 /root/.ssh和/app/.ssh目录,并将密钥文件放置在/app/.ssh目录下, 提高了与Woodpecker CI环境的兼容性。 ```
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user