【发布时间】:2021-03-12 13:54:51
【问题描述】:
我有一个带有子模块的存储库,当我推送到某些分支或标签时,我正在创建一个构建。我遇到的问题是我的结帐步骤无法访问我的子模块。设置是:
- 两个存储库都在 GitHub 上。
- 我是这两个存储库的所有者。
- 两个存储库都是私有的。
- 只能通过 ssh(禁用 https)访问存储库。
我尝试使用 GitHub Action actions/checkout@v2 无济于事。如下所示,我尝试使用“ssh-key”选项,其中我将公钥添加到子模块存储库部署密钥,并将私钥添加到运行操作的存储库的秘密。我收到以下错误消息:
Fetching the repository
/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin __myrepo__
ERROR: Repository not found.
Error: fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
The process '/usr/bin/git' failed with exit code 128
Waiting 13 seconds before trying again
/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin __myrepo__
ERROR: Repository not found.
Error: fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
The process '/usr/bin/git' failed with exit code 128
Waiting 19 seconds before trying again
/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin __myrepo__
ERROR: Repository not found.
Error: fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Error: The process '/usr/bin/git' failed with exit code 128
我尝试过使用和不使用ssh-key 以及submodules 上的true 和recursive 选项。子模块的目的地位于名为src 的目录中。我的工作流程中的结帐步骤如下:
Step-01:
runs-on: ubuntu-18.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: 'true'
ssh-key: ${{ secrets.PRIVATE_KEY_FOR_DEPLOY_KEY_IN_SUBMODULE }}
.gitmodules 是:
[submodule "name"]
path = src/name
url = git@github.com:user/repository.git
branch = master
我对 GitHub Actions 非常陌生(总体而言是 CI/CD),并且对子模块不太熟悉,所以我很可能犯了一些基本错误。
【问题讨论】:
标签: git github github-actions