You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As part of offering GHE compatibility #273, we need to make some UI decisions on how to onboard users, i.e. authenticate them against their instance and detect when a local repository is a clone from a GHE host as opposed to from github.com.
When in the context of a git repository, we might detect that the main git remote does not point to a github.com host, but to example.org, for example.
How should we assume if example.org is a GHE host that we should try authenticating against?
How should the authentication flow look like? E.g. Press Enter to open https://example.org/authorize in your browser
If there are several git remotes of which some point to github.com and others to a GHE host, which one should we default to?
When not in the context of a git repository, how should users instruct commands such as repo create, repo clone owner/repo, repo fork owner/repo, and commands such as issue view 123 -R owner/repo to operate on their GHE instance instead of github.com?
In hub, users may set GITHUB_HOST=example.org in their environment before invoking a hub command, and that solution is fine for programmatic use, but not ideal for casual use.
Also in hub, whenever a user has previously authenticated against their GHE host, commands like hub clone repo prompt with Select host: and github.com, example.org as options. This works, but I find the interactive prompt sometimes tiresome considering I'm cloning from github.com 99% of the time.
We will add a dedicated authentication command, so when we encounter a hostname we don't recognize, we can print something like: To authenticate against example.com GitHub Enterprise instance, run `gh auth example.com` Dedicated authentication command #1413
Proposed syntaxes for explicitly selecting a hostname:
gh repo view hubot/robots --host example.com
gh repo view example.com/hubot/robots
GH_HOST=example.com gh repo view hubot/robots
gh issue list -R example.com/hubot/robots
When someone has authenticated against multiple GitHub hosts, but hasn't explicitly specified one for a command such as gh repo clone, there will be a prompt asking you to select a host.
Perhaps there could be a config setting to specify a default host?
A nice default for some commands might be to look at the remote-tracking branches of HEAD, e.g.
gh repo fork -> default to forking the @{upstream} branch's remote
gh pr create -> default to creating a PR to merge @{push} into @{upstream} (or merge @{upstream} into <prompt for remote> if @{push} == @{upstream})
gh pr checkout -> default to checking @{upstream} remote for PRs
I currently use hub to have a zero-manual-effort g pr command, but it doesn't work when you have more than 2 remotes because, and it would be really nice to have this work in that context.
This works, but I find the interactive prompt sometimes tiresome considering I'm cloning from github.com 99% of the time.
FWIW 90% of the time I'm interacting with GHE (although it's really irritating because I already set up my remotes, so things should work with that).
Allowing the --repo option to directly take a URL instead of just a org/repo combo would make things a lot easier, especially in situations when copy-pasting, or passing in input from scripts. Raised #1505
Activity
mislav commentedon Jul 23, 2020
After chats with @ampinsk:
We will add a dedicated authentication command, so when we encounter a hostname we don't recognize, we can print something like:
To authenticate against example.com GitHub Enterprise instance, run `gh auth example.com`Dedicated authentication command #1413Proposed syntaxes for explicitly selecting a hostname:
gh repo view hubot/robots --host example.comgh repo view example.com/hubot/robotsGH_HOST=example.com gh repo view hubot/robotsgh issue list -R example.com/hubot/robotsWhen someone has authenticated against multiple GitHub hosts, but hasn't explicitly specified one for a command such as
gh repo clone, there will be a prompt asking you to select a host.gibfahn commentedon Aug 5, 2020
A nice default for some commands might be to look at the remote-tracking branches of
HEAD, e.g.gh repo fork-> default to forking the@{upstream}branch's remotegh pr create-> default to creating a PR to merge@{push}into@{upstream}(or merge@{upstream}into<prompt for remote>if@{push}==@{upstream})gh pr checkout-> default to checking@{upstream}remote for PRsI currently use
hubto have a zero-manual-effortg prcommand, but it doesn't work when you have more than 2 remotes because, and it would be really nice to have this work in that context.FWIW 90% of the time I'm interacting with GHE (although it's really irritating because I already set up my remotes, so things should work with that).
mislav commentedon Aug 6, 2020
After chats with @ampinsk, this is how a selection of a default host could look like:
gibfahn commentedon Aug 8, 2020
Allowing the
--repooption to directly take a URL instead of just a org/repo combo would make things a lot easier, especially in situations when copy-pasting, or passing in input from scripts. Raised #1505