如何在github动作中使用私人子模块的私人仓库Git克隆?
我的组织(或用户)内有两个私人GitHub存储库。其中一个包含另一个作为子模块。如何用包含的子模块克隆其他私人存储库?
但是,我尝试了
- uses: actions/checkout@v3
with:
submodules: true
这件在子模块部分上的错误消息失败,我应该添加一些权限还是其他权限?
Fetching submodules
/usr/bin/git submodule sync
/usr/bin/git -c protocol.version=2 submodule update --init --force --depth=1
Submodule '.github/workflows/MYPROJECT1' (https://github.com/MYUSER/MYPROJECT1.git) registered for path '.github/workflows/MYPROJECT1'
Cloning into '/home/runner/work/MYPROJECT2/MYPROJECT2/.github/workflows/MYPROJECT1'...
remote: Repository not found.
Error: fatal: repository 'https://github.com/MYUSER/MYPROJECT1.git/' not found
Error: fatal: clone of 'https://github.com/MYUSER/MYPROJECT1.git' into submodule path '/home/runner/work/MYPROJECT2/MYPROJECT2/.github/workflows/MYPROJECT1' failed
Failed to clone '.github/workflows/MYPROJECT1'. Retry scheduled
... more errors
I have two private GitHub repositories within my organisation (or my user). One of them contains the other as a submodule. How can I clone this other private repository with its containing submodule?
I tried
- uses: actions/checkout@v3
with:
submodules: true
However this failed with an error message on the submodule part, is there some permission I should add or other?
Fetching submodules
/usr/bin/git submodule sync
/usr/bin/git -c protocol.version=2 submodule update --init --force --depth=1
Submodule '.github/workflows/MYPROJECT1' (https://github.com/MYUSER/MYPROJECT1.git) registered for path '.github/workflows/MYPROJECT1'
Cloning into '/home/runner/work/MYPROJECT2/MYPROJECT2/.github/workflows/MYPROJECT1'...
remote: Repository not found.
Error: fatal: repository 'https://github.com/MYUSER/MYPROJECT1.git/' not found
Error: fatal: clone of 'https://github.com/MYUSER/MYPROJECT1.git' into submodule path '/home/runner/work/MYPROJECT2/MYPROJECT2/.github/workflows/MYPROJECT1' failed
Failed to clone '.github/workflows/MYPROJECT1'. Retry scheduled
... more errors
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试使用SSH URL。
第116页“私人子模型结帐失败”选择:
第287期(“支持私人存储库和私有子模块”)还包括:
,而这个评论确认 ssh-agent方法。
前面提到的第116期也包括:
You can try and use an SSH URL instead.
The issue 116 "private submodule checkout fails" now (July 2022) illustrates that as an alternative:
Issue 287 ("Support private repositories and private submodule") also includes:
And this comment confirms the ssh-agent approach.
The previously mentioned issue 116 also includes:
这是使用GitHub Pats对我有用的两种方法。私人存储库和私有子模块被克隆。参数是从GHA或K8S Secrets Store中提取的。
Here are 2 approaches that worked for me using Github PATs. The private repo and private submodule(s) are cloned. Parameters are pulled from either GHA or K8s secrets store.