-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Repo commands assume non-enterprise auth and fail trying to auth against github.com #1745
Comments
that should work; sorry about that.
|
@natdempk For now, commands require you to explicitly set a hostname if it's not github.com:
If that proves to be tedious, you can set the GH_HOST environment variable with the name of your host:
Be warned though, if you then want to clone Is the current design and workaround acceptable for you, or did you expect the command to work differently? Sorry for the confusion. |
Ah cool, thanks for the context and workaround. To answer some of the above questions:
Correct.
No, it is just from my personal user.
So, this actually seems like it may have uncovered another bug, though this might also be intended behavior. 😅 I noticed that it sort of works, but in this case I am asked for a username + password for the clone instead of using my configuration to clone via ssh if the clone is prepended with
But without the protocol works fine:
Given that by default I'm going to copy-paste a URL with a protocol, it seems a bit counter-intuitive to have to strip it off. 🤷♂️
Yeah as an enterprise user I would have expected this to work a bit differently. I think if a user has only configured one of the two authentication sources, that should be used as a default everywhere. If both are configured maybe it is reasonable to default to GitHub.com, the last used one, or add a setting for a default auth preference. |
Likely same bug as this - I configured token auth for github enterprise. Setting the |
@wimglenn No, we never send a token for one host to another host. The thing is, gh probably doesn't have your authentication token for github.com, so it sent an anonymous API request to This will be fixed after the switch to GraphQL #1712 |
Thanks for the explanation. I am reassured that my GHE token was not being sent to github.com. |
@natdempk I see; really interesting point! When you paste a full URL to a repository, we assume that we should use the clone protocol from the URL, rather than respecting your default, but I can see how that was surprising to you. We will reconsider this default. |
Ideally, it would be great if I could set up different In
|
I got a similar error when I started using the gh CLI to access a GitHub Enterprise Server (GHES). Turned out that the clone command was using a credential manager on my machine, but the credentials were out of date (and not using a token). Updated the credential manager with the token then the clones worked fine. |
I like the idea of adding a per-directory "default hostname". |
I still wonder - when I have a single GHE entry, and no github.com entry in my It seems having GH_HOST auto-detect/default when there is only one host configured should resolve this issue in most cases? |
@jherland You are right. We are leaning to the solution you propose: to default to your non-github.com host if only one host was configured. However, if you configure one Enterprise host, and then additionally authenticate to github.com as well, we will start defaulting to github.com again. This was our original reasoning to always default to github.com—to follow the principle of least surprise—but our users seem to predominately want to default to whichever one host they authenticated to. |
Yes, I agree that if you have more than one host configured, then you cannot expect the Enterprise host to be used by default. I'd maybe argue that you should be prompted for which to use (or you should be able to explicitly choose a default), but this (to me) is much less important than using the configured host when there is only one. |
I was hoping there might be a way to set a default in |
After doing the above for about a month, I still get the impression the public/enterprise combined workflow could be cleaner. So I opened #6688 as a feature proposal. |
Describe the bug
I've configured enterprise GitHub auth, but when I run a command like
gh repo clone "ndempkowski/python-stuff"
which refers to an enterprise repository, it seems like the cli assumes that I want to resolve against github.com. This leads to an error instead of my repo being cloned.Steps to reproduce the behavior
OWNER/REPO
formatExample:
Yet my auth status is shown as correctly configured:
Expected vs actual behavior
I expect to be able to clone a repo using the
OWNER/REPO
format instead of seeing an error.Logs
See above
The text was updated successfully, but these errors were encountered: