-
I’m using this command to check and see if a remote private repo exists and the user has access to it:
Also checking for a branch on the remote repo:
These should be able to access the private repo using the access token passed into the action, and I should get an actual read on the remote repo and its refs. However, I receive a git error:
Notably, this output doesn’t include the classic *** to hide the token in the output URL because, well… it isn’t in this error URL at all. It’s not an issue with the token or URL because the action successfully clones the private repo immediately after these commands fail. (Also, it works as expected on my local machine.) So why would this command fail on the runner? I’m at a loss here. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
I figured out the problem! I was using the GH checkout action as a first step, and the GITHUB_TOKEN credentials were automatically persisting through the entire workflow. So anytime I tried to run a command requiring the auth token for the second remote repo, it was using the persisted credentials. I set Some odd things about this, though –
Anyway, I hope this helps someone down the line. Happy coding! |
Beta Was this translation helpful? Give feedback.
-
Thanks for sharing this! Saved a few hours of debugging for sure. |
Beta Was this translation helpful? Give feedback.
-
Thank you sooo much!!! I have the same set up it seems where I call |
Beta Was this translation helpful? Give feedback.
-
Thanks for this. We had accidentally included the .git/ dir in our docker image, and then git ls-remote was failing in production due to the cached credentials. |
Beta Was this translation helpful? Give feedback.
I figured out the problem! I was using the GH checkout action as a first step, and the GITHUB_TOKEN credentials were automatically persisting through the entire workflow. So anytime I tried to run a command requiring the auth token for the second remote repo, it was using the persisted credentials. I set
persist-credentials
to false, and my commands work as expected.Some odd things about this, though –
Anyway, I hope this helps someone down the line. Happy coding!