我有一个Github,我在git-sync中配置它,通过使用PAT令牌指定回购URL来同步文件与我的Kubernetes气流实例,如下所示:
https://<PAT>@github.com/org/dag_repo.git`(PAT令牌由CI/CD插入,未提交给dag_repo)
这个Github还具有多个其他的GitHub Repos,它们使用以下命令作为git子模块添加:
git submodule add https://<PAT>@github.com/org/test-git-sync.git我的.gitmodules文件如下所示:
[submodule "test-git-sync"]
path = test-git-sync
url = https://<PAT>@github.com/org/test-git-sync.git因此,在子模块文件中,git保存的是敏感的PAT令牌,因此我不能将它提交给Github。
我尝试在没有PAT令牌的情况下添加子模块repo --但是在本例中,git-sync无法签出子模块,因为子模块repo是私有的,并且没有指定auth。
.gitmodules文件中,然后git-sync可以在运行时注入PAT??
发布于 2022-08-25 18:34:44
可以在git子模块中提供相对路径,以使用与父模块相同的repo配置。在我的示例中,.gitmodules文件中的以下配置使其工作:
[submodule "test-git-sync"]
path = test-git-sync
url = ../test-git-sync.git # use relative pathhttps://stackoverflow.com/questions/73492078
复制相似问题