【问题标题】:Is it possible to checkout a public Github repository from enterprise repository with Github Actions?是否可以使用 Github Actions 从企业存储库检出公共 Github 存储库?
【发布时间】:2022-11-20 21:18:24
【问题描述】:

我想在我的 Github Actions 工作流中签出一个公共存储库,该工作流在 Enterprise Github 中托管的存储库中运行。我正在使用在我的公共 Github 帐户中生成的 PAT 来进行身份验证。

我检查公共回购的工作流程步骤如下所示:

  - name: Check out the public repository
         uses: actions/checkout@v3
         with:
           repository: public_org_name/public_git_repo_name
           token: ${{ secrets.PAT }}
           github-server-url: https://github.com

我有一个错误说它是错误的凭据。在我的公共 github 帐户中生成的 PAT 值与我的 github secrets PAT 的值相同。

错误日志:

Determining the default branch
  Retrieving the default branch name
  Bad credentials
  Waiting 14 seconds before trying again
  Retrieving the default branch name
  Bad credentials
  Waiting 19 seconds before trying again
  Retrieving the default branch name
  Error: Bad credentials

在日志中的 git repo 初始化期间,我有:

 /bin/git remote add origin https://ENTEPRISE_GITHUB.COM/public_org_name/public_git_repo_name

这不应该是:

https://github.com/public_org_name/public_git_repo_name

我也收到这个警告

Warning: Unexpected input(s) 'github-server-url', valid inputs are ['repository', 'ref', 'token', 'ssh-key', 'ssh-known-hosts', 'ssh-strict', 'persist-credentials', 'path', 'clean', 'fetch-depth', 'lfs', 'submodules', 'set-safe-directory']

github-server-url 是合法的参数,如docs 所示

,值得一提的是,我可以毫无问题地克隆我的公共仓库 git clone

例子:

- name: Code Checkout
        run: |
          git clone https://username:${{ secrets.PAT }}@github.com/public_org_name/public_git_repo_name.git

bad credentials 错误是否具有误导性?我是否没有以正确的方式进行结帐操作?

【问题讨论】:

    标签: github github-actions


    【解决方案1】:

    “不良凭证”具有误导性。警告是真正的问题......

    您的警告实质上是在告诉您它不知道如何处理 github-server-url,因此它不知道在哪里进行身份验证,因此不知道错误的凭据错误。我怀疑您以某种方式使用了尚未包含 github-server-url 选项的旧版本操作。

    查看更改日志,这是最近添加的内容: https://github.com/actions/checkout/blob/v3.1.0/CHANGELOG.md#v310

    【讨论】:

      猜你喜欢
      • 2015-07-09
      • 2020-02-01
      • 2018-06-23
      • 2012-06-01
      • 1970-01-01
      • 2021-09-29
      • 2019-12-04
      • 2020-10-19
      • 2020-02-13
      相关资源
      最近更新 更多