-
Notifications
You must be signed in to change notification settings - Fork 47
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
Allow default host to be determined based on configuration preference #160
Comments
I'm intrigued by the idea. A few questions jump to mind:
Thanks! |
With Beyond that, I can only theorize GitHub Enterprise Server users with GitHub.com accounts using features like
I think introducing a new Originally, I was considering
Yes!
This is a really good question and I actually wondered about this exact case! Reviewing the USAGE
gh extension install <repository> [flags]
FLAGS
--force force upgrade extension, or ignore if latest already installed
--pin string pin extension to a release tag or commit ref
INHERITED FLAGS
--help Show help for command
EXAMPLES
$ gh extension install owner/gh-extension
$ gh extension install https://git.example.com/owner/gh-extension
$ gh extension install . Looking for commands that leverage $ grep -rl "RepoHost()" pkg/cmd | sort | uniq
pkg/cmd/cache/delete/delete.go
pkg/cmd/cache/shared/shared.go
pkg/cmd/extension/command.go
pkg/cmd/extension/http.go
pkg/cmd/extension/manager.go
pkg/cmd/factory/default_test.go
pkg/cmd/issue/close/close.go
pkg/cmd/issue/create/create.go
pkg/cmd/issue/delete/delete.go
pkg/cmd/issue/develop/develop.go
pkg/cmd/issue/list/http.go
pkg/cmd/issue/list/list.go
pkg/cmd/issue/lock/lock.go
pkg/cmd/issue/pin/pin.go
pkg/cmd/issue/reopen/reopen.go
pkg/cmd/issue/shared/lookup.go
pkg/cmd/issue/status/status.go
pkg/cmd/issue/transfer/transfer.go
pkg/cmd/issue/unpin/unpin.go
pkg/cmd/issue/view/http.go
pkg/cmd/label/create.go
pkg/cmd/label/delete.go
pkg/cmd/label/http.go
pkg/cmd/pr/checkout/checkout.go
pkg/cmd/pr/checkout/checkout_test.go
pkg/cmd/pr/checks/checks.go
pkg/cmd/pr/close/close_test.go
pkg/cmd/pr/create/create.go
pkg/cmd/pr/diff/diff.go
pkg/cmd/pr/list/http.go
pkg/cmd/pr/merge/http.go
pkg/cmd/pr/shared/commentable.go
pkg/cmd/pr/shared/editable.go
pkg/cmd/pr/shared/editable_http.go
pkg/cmd/pr/shared/finder.go
pkg/cmd/pr/shared/params_test.go
pkg/cmd/pr/shared/templates.go
pkg/cmd/pr/status/http.go
pkg/cmd/pr/status/status.go
pkg/cmd/release/create/http.go
pkg/cmd/release/delete/delete.go
pkg/cmd/release/edit/http.go
pkg/cmd/release/list/http.go
pkg/cmd/release/shared/fetch.go
pkg/cmd/repo/archive/http.go
pkg/cmd/repo/clone/clone.go
pkg/cmd/repo/create/create.go
pkg/cmd/repo/credits/credits.go
pkg/cmd/repo/delete/http.go
pkg/cmd/repo/deploy-key/add/http.go
pkg/cmd/repo/deploy-key/delete/http.go
pkg/cmd/repo/deploy-key/list/http.go
pkg/cmd/repo/edit/edit.go
pkg/cmd/repo/fork/fork.go
pkg/cmd/repo/garden/http.go
pkg/cmd/repo/rename/rename.go
pkg/cmd/repo/setdefault/setdefault.go
pkg/cmd/repo/sync/http.go
pkg/cmd/repo/sync/sync.go
pkg/cmd/repo/unarchive/http.go
pkg/cmd/repo/view/http.go
pkg/cmd/ruleset/check/check.go
pkg/cmd/ruleset/shared/http.go
pkg/cmd/ruleset/view/http.go
pkg/cmd/run/cancel/cancel.go
pkg/cmd/run/delete/delete.go
pkg/cmd/run/rerun/rerun.go
pkg/cmd/run/shared/artifacts.go
pkg/cmd/run/shared/shared.go
pkg/cmd/run/view/view.go
pkg/cmd/secret/list/list.go
pkg/cmd/secret/set/http.go
pkg/cmd/secret/set/set.go
pkg/cmd/variable/list/list.go
pkg/cmd/variable/set/http.go
pkg/cmd/variable/set/set.go
pkg/cmd/workflow/disable/disable.go
pkg/cmd/workflow/enable/enable.go
pkg/cmd/workflow/run/run.go
pkg/cmd/workflow/shared/shared.go |
Given you are looking for use cases. Got an account on GHES and github.com and logged in to both. When creating a repository Summarizing, Similarly, using
|
Dankjewel for the use case, it's definitely handy to have. Indeed If you could wave a magic wand for the CLI, what would the workflow around changing hosts look like for you? Cheers! |
xlinking cli/cli#10058 for discussion where GHES user expecting default host to be something other than github.com |
I'm looking for a CLI way of switching between hosts, specifically between GHES and GHEC. CLI should keep record of the configured hosts (name and URL) and should request this when configurating an authentication. Given a certain authorization is always coupled to a certain host, I would expect that If this somehow interferes with other uses cases, a separate command would be acceptable, e.g., |
Thanks for the details @ruudgoossens, useful to have your feedback.
The current way to achieve this is to set
Yeh that would have been a sensible implementation if the CLI had previously had any form of switching a host via command but up to this point it's always been via |
Problem I'm dealing with
Terminal users who are not terminal savvy finding the environment variable only approach to overriding the default host logic confusing.
For multi-account users whose primary GitHub host is not
github.com
, they must useGH_HOST
environment variable to target the appropriate host for core GitHub CLI commands or GitHub CLI extensions without repository context. It is also possible for core GitHub CLI commands and GitHub CLI extension authors to add support for--hostname
flag to explicitly communicate this can be set / overridden but must be added intentionally.The problem comes in for terminal users who are not savvy to working with terminals:
This setting must be managed separately from hosts authenticated via
gh auth login
if the user
gh auth logout
from this host, then errors occurShells offer different levels of scoping environment variables
GH_HOST=... gh api ...
)PowerShell does not support this
export GH_HOST=...
).zshrc
,.bashrc
,~/.config/powershell/profile.ps1
)Inconsistent experiences for users unfamiliar with login sessions versus non-interactive sessions
.zprofile
vs.zshrc
,.bashrc
vs.bash_profile
Ideas to address this
What if we could indicate which host should be the default?
In the example above, I want to specify that
github.ghe.com
is my default host in the event that the host can't be determined by repository context.This would involve change to the following logic for determining default host:
go-gh/pkg/auth/auth.go
Lines 130 to 150 in dbd982e
The text was updated successfully, but these errors were encountered: