小编Bjø*_*org的帖子

如何在 github 操作中推送到另一个存储库?

在 Github Actions 中,我尝试对与工作流所属存储库不同的存储库进行一些更改。看到这个代码:

      - name: Generate API module
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: |

          git clone https://user:$GITHUB_TOKEN@github.com/owner/my-repo # This works

          cd my-repo
          git config user.name "user"
          git config user.email "dev@example.com"

          git checkout -b api-version-$COMMIT

          touch new-file.sh
          git add new-file.sh
          git commit -m "Add new file"

          git remote -v # Prints:
          # origin ***github.com/owner/my-repo.git (fetch)
          # origin ***github.com/owner/my-repo.git (push)

          git push --set-upstream origin api-version-$COMMIT # This does not work
          git push --set-upstream https://user:$GITHUB_TOKEN@github.com/owner/my-repo api-version-$COMMIT # This does not work …
Run Code Online (Sandbox Code Playgroud)

git github-actions

7
推荐指数
4
解决办法
3068
查看次数

标签 统计

git ×1

github-actions ×1