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.
CodePudding user response:
how to do is get them added to the credential manager
In command line
printf "host=remote.host.name\nprotocol=https\nusername=aUser\npasswprd=<yourPAT>" | \
git credential-manager-core store
(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
)