首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何允许从代码构建CDK管道访问私有GitHub存储库?

如何允许从代码构建CDK管道访问私有GitHub存储库?
EN

Stack Overflow用户
提问于 2022-10-08 20:27:00
回答 1查看 103关注 0票数 1

我正在Golang编写一个CDK管道,CDK构建将从私有GitHub存储库导入一个包。

构建CDK项目并启动CDK synth命令的yaml文件如下所示:

错误:

代码语言:javascript
复制
internal/infrastructure/file.go:10:2: github.com/private-repository/lb@v0.0.0-20220707180825-25060de2ad6d: invalid version: git ls-remote -q origin in /go/pkg/mod/cache/vcs/82d62389c6040b63289b711060bd7a3817a57a89b79a0f50ca152ad3d073eca1: exit status 128:
351     Warning: Permanently added the RSA host key for IP address '11.11.11.11' to the list of known hosts.
352     git@github.com: Permission denied (publickey).
353     fatal: Could not read from remote repository.
354     
355     Please make sure you have the correct access rights
356     and the repository exists.
357 
358 Subprocess exited with error 1

以上是我在管道无法从GitHub下载私有存储库时遇到的错误。

有人能帮我解释一下为什么会发生这种情况吗?我该如何解决这个问题?

EN

回答 1

Stack Overflow用户

发布于 2022-11-19 06:54:51

我正面临着问题,我在这里发现了什么。

  1. 您必须将github令牌声明为一个秘密值。
  2. 然后将它添加到您的cdk堆栈中。

代码语言:javascript
复制
new codebuild.GitHubSourceCredentials(this, 'CodeBuildGitHubCreds', {
    accessToken: SecretValue.secretsManager(githubTokenSecretValueName),
});

注意:

  • 只需在定义代码构建项目之前声明它.
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74000322

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档