Terraform Github操作和git克隆问题
在Github操作中使用git clone时遇到一些问题,无论我如何尝试,都会得到以下结果: my main.yml中失败的代码:Terraform Github操作和git克隆问题,terraform,github-actions,Terraform,Github Actions,在Github操作中使用git clone时遇到一些问题,无论我如何尝试,都会得到以下结果: my 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.
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
错误消息:
git@github.com:权限被拒绝(公钥)
我看过很多关于添加ssh密钥的帖子,但都是本地发布的,而不是从Github actions运行的ubuntu版本中发布的——我在这里遗漏了什么?我无法生成ssh密钥并将私钥动态添加到Github repo设置中,如何解决此问题?如果您需要签出两个存储库,我建议再次使用
签出
到相对路径。请参阅文档以了解更多信息。您可能需要使用repo
范围
如果确实需要,可以通过SSH来克隆存储库
actions/checkout
以使用您创建的部署密钥那么这个需要添加的代币,就是蓝图回购协议中的类似代币,现在也添加到当前回购协议中,希望查看蓝图?谢谢你的回复!需要在对blueprint-repo具有写访问权限的帐户上创建。快速跟进,我在通过变量插值访问PAT时遇到问题-PAT是通过开发人员设置为用户创建的,我是否仍然可以使用{{secrets.PAT}?这似乎仅适用于在回购协议上创建的机密?创建PAT后,您需要将其作为机密添加到运行工作流的存储库中。你可以随便说出这个秘密的名字。我在示例中使用了
PAT
,然后我可以在.yml中使用{{secrets.whatevername}}来访问该私有回购?
- name: 'Checkout'
uses: actions/checkout@v2
- name: 'Preparing blueprint-environment'
uses: actions/checkout@v2
with:
token: ${{ secrets.PAT }}
repository: ourcompany/whateverrepo
path: whateverrepo
steps:
- uses: actions/checkout@v2
with:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}