sha*_*kka 5 terraform github-actions
在 Github Actions 中使用 git clone 时遇到一些问题,无论我尝试什么,我都会得到以下信息:
我的 main.yml 中失败的代码:
jobs:
terraform:
name: 'Terraform with Github Actions!'
runs-on: ubuntu-latest
steps:
- name: 'Login to Azure'
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: 'Checkout'
uses: actions/checkout@master
- name: 'Preparing blueprint-environment'
run: |
snip
git clone git@github.com:ourcompany/whateverrepo.git
Run Code Online (Sandbox Code Playgroud)
错误信息:
git@github.com:权限被拒绝(公钥)。
我看过很多关于添加 ssh 密钥的帖子,但那是本地的,而不是在从 Github 操作运行的 ubuntu 版本中 - 我在这里缺少什么?我无法生成 ssh 密钥并将私钥动态添加到 Github 存储库设置,我该如何解决此问题?
pet*_*ans 10
如果您需要签出两个存储库,我建议checkout再次使用相对路径。请参阅文档并排检查多个存储库。您可能需要使用repo范围个人访问令牌 (PAT)
- name: 'Checkout'
uses: actions/checkout@v2
- name: 'Preparing blueprint-environment'
uses: actions/checkout@v2
with:
token: ${{ secrets.PAT }}
repository: ourcompany/whateverrepo
path: whateverrepo
Run Code Online (Sandbox Code Playgroud)
如果确实有必要,可以使用部署密钥通过 SSH 克隆存储库。
actions/checkout为使用您创建的部署密钥。 steps:
- uses: actions/checkout@v2
with:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13768 次 |
| 最近记录: |