[英]git-sync using github personal access token (PAT) for git submodules
I have a Github repo which I configure in git-sync to sync files with my Kubernetes airflow instance by specifying the repo URL with PAT token like below: I have a Github repo which I configure in git-sync to sync files with my Kubernetes airflow instance by specifying the repo URL with PAT token like below:
https://<PAT>@github.com/org/dag_repo.git`
(PAT token is inserted by CI/CD and not committed to github to the dag_repo) (PAT 令牌由 CI/CD 插入,未提交到 github 到 dag_repo)
This Github repo also has multiple other GitHub Repos added as git submodules using the command:此 Github 存储库还使用以下命令将多个其他 GitHub 存储库添加为 git 子模块:
git submodule add https://<PAT>@github.com/org/test-git-sync.git
My .gitmodules
file looks like the below:我的
.gitmodules
文件如下所示:
[submodule "test-git-sync"]
path = test-git-sync
url = https://<PAT>@github.com/org/test-git-sync.git
So in the submodule file git is saving the PAT token which is sensitive - thus I cannot commit it to Github因此在子模块文件 git 中保存了敏感的 PAT 令牌 - 因此我无法将其提交给 Github
I tried adding the submodule repo without a PAT token - but in this case, git-sync is not able to check out the submodule because the submodule repo is private and no auth is specified.我尝试在没有 PAT 令牌的情况下添加子模块存储库 - 但在这种情况下,git-sync 无法签出子模块,因为子模块存储库是私有的并且没有指定身份验证。
.gitmodules
file and then git-sync can inject PAT during run-time?.gitmodules
文件中对 PAT 令牌进行参数化,然后 git-sync 可以在运行时注入 PAT? It is possible to provide relative paths in the git submodule to use the same repo config as the parent.可以在 git 子模块中提供相对路径,以使用与父级相同的 repo 配置。 In my case the below config in
.gitmodules
file made it work:在我的情况下,
.gitmodules
文件中的以下配置使其工作:
[submodule "test-git-sync"]
path = test-git-sync
url = ../test-git-sync.git # use relative path
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.