如何在云构建器中访问私有Github存储库?(How do I access a private Github repository within a cloud builder?)

编程入门 行业动态 更新时间:2024-10-25 06:27:10
如何在云构建器中访问私有Github存储库?(How do I access a private Github repository within a cloud builder?)

我在Github上有两个私有存储库,A和B.两个都是Golang项目。 项目A取决于存储库B.我已将这两个存储库链接到Google源代码并同意权限。

Cloudbuild.yaml

- name: 'gcr.io/cloud-builders/git' args: ['clone', 'https://source.developers.google.com/p/$PROJECT_ID/r/B']

从容器构建器记录

Starting Step #0 Step #0: Already have image (with digest): gcr.io/cloud-builders/git Step #0: Cloning into 'B'... Finished Step #0 ... Step #1: [0;33m[WARN] [mUnable to checkout github.com/user/B Step #1: [0;31m[ERROR] [mUpdate failed for github.com/user/B: Unable to get repository: Cloning into '/builder/home/.glide/cache/src/B'... Step #1: fatal: could not read Username for 'https://github.com': No such device or address Step #1: : exit status 128

有没有人能够使用容器生成器和Google自己的源代码库? 我不想使用'云密钥管理服务'来解决这个问题。

已经试过: https : //github.com/GoogleCloudPlatform/cloud-builders/issues/44#issuecomment-325144047

I have two private repositories on Github, A and B. Both are Golang projects. Project A depends on repository B. I have linked both repositories to Google Source Code and consented with permissions.

Cloudbuild.yaml

- name: 'gcr.io/cloud-builders/git' args: ['clone', 'https://source.developers.google.com/p/$PROJECT_ID/r/B']

Log from container builder

Starting Step #0 Step #0: Already have image (with digest): gcr.io/cloud-builders/git Step #0: Cloning into 'B'... Finished Step #0 ... Step #1: [0;33m[WARN] [mUnable to checkout github.com/user/B Step #1: [0;31m[ERROR] [mUpdate failed for github.com/user/B: Unable to get repository: Cloning into '/builder/home/.glide/cache/src/B'... Step #1: fatal: could not read Username for 'https://github.com': No such device or address Step #1: : exit status 128

Have anyone got glide to work with container builder and googles own source repositories? I don't want to use 'Cloud Key Management Service' to solve this issue.

Have already tried: https://github.com/GoogleCloudPlatform/cloud-builders/issues/44#issuecomment-325144047

最满意答案

我没有使用云构建的经验,但是您应该使用ssh://而不是https://来克隆您的git存储库。 那么你需要在repo中添加一个SSH密钥(在github中称为部署密钥,每个repo或你的用户帐户)并在克隆时使用相同的密钥(在Linux中通常足以将私钥文件放在的〜/ .ssh)。 我想你可能发现哪些涉及云KMS的解决方案可以做同样的事情,但安全地存储私钥。

I have no experience with cloud build but you should use ssh:// instead of https:// for cloning your git repository. then you'll need to add a SSH key to the repo (in github its called deploy keys, either per repo or for your user account) and use the same key when cloning (in Linux its usually enough to put the private key file under ~/.ssh). I guess that solutions you may found which involve Cloud KMS do the same thing but store the private key securely.

更多推荐

本文发布于:2023-08-04 06:37:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1412424.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:器中   如何在   Github   access   builder

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!