Skip to content

Github Actions - git command ls-remote fails for private repo when on runner (works locally) #25240

Answered by aormsby
aormsby asked this question in Actions
Discussion options

You must be logged in to vote

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 –

  • If I have the auth token in the remote URL, I don’t see why the action would even try to use the persisted auth token.
  • Why did the clone work while the other commands didn’t? Super strange.

Anyway, I hope this helps someone down the line. Happy coding!

Replies: 4 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@dodomood
Comment options

@pedroscaff
Comment options

@robindowling
Comment options

@dan-developer
Comment options

Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment