从命令行将作用域 PAT 添加到 git 凭证帮助程序
我有一个 Gitlab CI 管道正在构建一个 Unity 项目,该项目包含从 git 存储库中提取的包。有很多软件包,但它们都在两组中的一组中,并且我可以获得这两个组的 PAT(由于一些其他限制,我无法在这个特定实例中使用 SSH 密钥)。 Unity 使用 git 凭证管理器对包进行身份验证(详细信息),但我我不确定如何从命令行将这些凭据实际添加到帮助程序中。
运行程序在 Windows 10 计算机上使用 Shell 执行器,我可以使用环境变量注入 PAT,但我不知道该怎么做的部分是将它们添加到凭据管理器中,在这种情况下,它们将需要范围仅限于特定群组网址,类似于此答案。此计算机上的 git 安装也配置为使用 Windows 凭据管理器。
I have a Gitlab CI pipeline that's building a Unity project which has packages being pulled from a git repository. There are a number of packages, but they're all in one of two groups, and I can get a PAT for both (I can't use SSH keys in this particular instance due to some other constraints). Unity uses the git credential manager to authenticate for packages (details), but I'm unsure how to actually add those credentials to the helper from the command line.
The runner is using the Shell executor on a Windows 10 machine, and I can inject the PATs using environment variables, but the part I don't know how to do is get them added to the credential manager, and in this case they will need to be scoped to the specific group URLs similar to this answer. The git installation on this machine is also configured to use the Windows Credential Manager.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
命令行中的
凭据管理器中(如 评论由OP Alex McCraw,需要安装 适用于 Windows 的最新 Git,2.35.1.2,在撰写本文时,2022 年第 1 季度)
这假设在 Windows 上执行时10 台机器:
git config credential.helper
返回credential-manager-core
git-credential-manager-core.exe
在 PATH 中(或您需要使用完整路径C:\Program Files\Git\mingw64\libexec\git-core\git-credential-manager-core.exe
)In command line
(As commented by the OP Alex McCraw, that requires installing the latest Git for Windows, 2.35.1.2, at the time of writing, Q1 2022)
This assume that, when executed on a Windows 10 machine:
git config credential.helper
returnscredential-manager-core
git-credential-manager-core.exe
is in the PATH (or you need to use the full pathC:\Program Files\Git\mingw64\libexec\git-core\git-credential-manager-core.exe
)