2

我正在尝试创建一个在每次推送时将更改推送到 pantheon 的操作,以便我们可以使用 GitHub 拥有更高级的工作流程,同时保持在 pantheon 上创建的开发站点的便利性。我设置了 3 个秘密

  1. SSH_KEY(私钥)
  2. 主机IP
  3. PANTHEON_REPO(网址)

在谷歌搜索后想出了这个动作:

name: Push to pantheon
on: [push,pull_request]
jobs:
  pusher:
    name: Push to pantheon
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install SSH key
        uses: shimataro/ssh-key-action@v2
        with:
          key: ${{ secrets.SSH_KEY }}
          known_hosts: 'just-a-placeholder-so-we-dont-get-errors'
      - name: Adding Known Hosts
        run: ssh-keyscan -H ${{ secrets.HOST_IP }} >> ~/.ssh/known_hosts
      - name: Push changes
        run: |
          git remote add pantheon ${{ secrets.PANTHEON_REPO }}
          git config --local user.email "..."
          git config --local user.name "Github Action"
          git push pantheon ${GITHUB_REF##*/}

git remote add但是,该操作因错误而失败:

Host key verification failed.
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我专门为此创建了 ssh 密钥并将公钥添加到 pantheon。

4

0 回答 0