Open Auroriax opened 1 year ago
@webbertakken Should we backport this into builder before v3?
This feature looks like something that we should support to me.
It doesn't look like a breaking change to me though. Unless I'm mistaken, we can also add it after the initial v3 release.
That said, if you feel this is something we can merge in somewhat quickly then I don't see why not.
@Auroriax Just took a look at your implementation and was wondering if you could explain what the git credential helper line is doing as I've never seen that format before: git config --global credential.helper '!f() { sleep 1; echo "username=$GIT_PRIVATE_USER"; echo "password=$GIT_PRIVATE_TOKEN"; }; f'
It would be good to have this for both Windows and Linux so I just need to know if it's cross-compatible.
If I remember correctly, I was looking for a way to set up the credential manager programatically and I stumbled upon this StackOverflow answer: https://stackoverflow.com/a/59890061 . Based on their explanation I don´t think it'll work on Windows (since essentially it's a shell script) but I don´t know for sure.
(I'm on a holiday at the moment and can help out more in ~2 weeks, if still needed!)
Thanks for the details! I think you're right about this not working on windows as we run using powershell so I don't think it's compatible. This probably won't make it in the initial v3 release then as I thought it would be a simple port but the windows side will likely be some work to convert and verify.
Hey, I've just stumbled upon this exact issue - what needs to be done to get it merged in to the current release? Happy to help if I can. I followed along in the discord but it also seems to have hit a dead end.
For context, this is my error output:
An error occurred while resolving packages:
Project has invalid dependencies:
com.atteneder.gltfast: Cannot checkout repository [https://github.com/atteneder/glTFast.git]:
Error when executing git command. WARNING: Multiple 'url.*..insteadof' keys with the same alias: "ssh://git@github.com/"
Downloading Documentation~/Images/Unity-glTF-workflows.png (59 KB)
Error downloading object: Documentation~/Images/Unity-glTF-workflows.png (aa50e39): Smudge error: Error downloading Documentation~/Images/Unity-glTF-workflows.png (aa50e3980f8e9a99e53b8347cdde7e293fe37ffb5e1469640379d802ef304541): batch response: Resource not accessible by personal access token
WARNING: Multiple 'url.*..insteadof' keys with the same alias: "ssh://git@github.com/"
Errors logged to /github/workspace/Library/PackageCache/.tmp-289-9gHhnk9V2pJE/clone/.git/lfs/logs/20240517T003318.352323914.log
Use `git lfs logs last` to view the log.
error: external filter 'git-lfs filter-process' failed
fatal: Documentation~/Images/Unity-glTF-workflows.png: smudge filter lfs failed
Context
In some cases I want to use the git credential manager, rather than the git URI rewrites that are currently done when using
gitPrivateToken
. For example, to work around any issues and edge cases, e.g. as described in #430.Suggested solution
A new build parameter called
gitPrivateUser
(name suggestions welcome). WhengitPrivateUser
andgitPrivateToken
are both provided, GameCI will set up the Git Credential Manager instead of git URI rewrites.Considered alternatives
Initially I tried to resolve the underlying bug for this problem (an issue similar to #430), but sadly I don't have the experience and time to do as such. However, setting up the git credential manager was a quick addition that resolved the permission issues we were having, and are planning to use for our projects.
Originally I wanted to switch to pull in the packages via SSH, but my senior pushed back on this given the extra setup required for all developers on the team, which is why we'd prefer to use HTTPS.
Additional details
Link to discussion on the Discord server: "Bad Credentials when resolving packages with git-lfs" Existing implementation in our fork of Unity Builder: https://github.com/Psylaris/unity-builder/commit/5f814eb1823b297d9361c645e02fcfe04c23537b (I can make a PR if requested.)