我有一个带子模块的代码仓库,当我推送到特定分支或标签时,我会创建一个构建。但问题是我的检出步骤无法访问我的子模块。设置如下:
- 两个代码仓库都在GitHub上。
- 我是这两个代码仓库的所有者。
- 两个代码仓库都是私有的。
- 仅支持ssh协议访问这两个代码仓库(禁用https)。
我已经尝试使用GitHub Action actions/checkout@v2
,但没有成功。如下所示,我已经尝试使用“ssh-key”选项,其中我将公钥添加到子模块代码仓库的部署密钥中,并将私钥添加到运行该Action的代码仓库的secrets中。我收到以下错误消息:
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)非常陌生,对子模块也不是很熟悉,所以可能会犯一些基本错误。