#Remote Repositories | Dagger
1 messages · Page 1 of 1 (latest)
Hey Marco!!
If you clone the repository manually using git clone, after gh auth login, does it clone the repo correctly?
I just did a quick test and the git CLI doesn't seem to be configured as they advertise on their docs. Digging deeper now
Running gh auth setup-git after login did the trick. It seems that gh auth login --wiht-token by default does not configure the git CLI itself. According to the help of gh auth setup-git --help:
This command configures
gitto use GitHub CLI as a credential helper.
For more information on git credential helpers please reference:
https://git-scm.com/docs/gitcredentials.By default, GitHub CLI will be set as the credential helper for all authenticated hosts.
If there is no authenticated hosts the command fails with an error.Alternatively, use the
--hostnameflag to specify a single host to be configured.
If the host is not authenticated with, the command fails with an error.
Apparently when you run gh auth login in a non-interactive mode (i.e by specifying --with-token) the gh CLI does not automatically configure git credentials. It's actually a prompt when doing the interactive login:
? Authenticate Git with your GitHub credentials? (Y/n) Y
Just tested it and works correctly with a private repo and a token
lol, was literally about to reply with this
beat me to it
we should put this in our docs
We should clarify this in the docs. I'll send a PR over
❤️
Funny enough. I asked copilot to write me a function for authenticating with gh cli yesterday and it got this right first time. The gh auth setup-git piece.