首页 > 解决方案 > 如何将 github 私有仓库添加到我的 Helm 环境

问题描述

我有一个github私人仓库(包含有效index.yaml文件),我想在helm不使用 github令牌的情况下将它添加到我的本地环境中,但我可以使用我的 gihub 凭据。我尝试过类似的东西

helm repo add <reponame> --username <username> --password xxxx https://<username>.github.io/reponame

错误信息

错误:看起来“ https://username.github.io/reponame ”不是有效的图表存储库或无法访问:无法获取 https://username.github.io/reponame/index.yaml:404 Not Found

但是即使没有传递我的 github 帐户的凭据,上面的命令也可以与公共 repo 一起使用,我也尝试过使用https://raw.githubusercontent.com/username/reponame/branch原始 url,但错误仍然存​​在。

标签: githubkubernetes-helm

解决方案


https://<username>.github.io/reponame看起来像一个GitHub 页面 URL,您可以将其与Fluxcd/helm-operator-get-started issue 28进行比较。
它指出了一个有效的图表面

它的存储库包括相关的 yaml 文件

在“使用私有 github 存储库作为 helm chart repo (https 访问) ”之后,使用令牌似乎是强制性的。
如果您激活了 2FA,那肯定是这样。

OP Pycoder在评论中确认:

我可以:


  • 在 URL ' https://<token>@raw.githubusercontent.com/<username>/<reponame>/master/'中传递个人访问令牌,
  • 或在密码标志中传递令牌
    helm add repo --username <username> --password <token> url

推荐阅读