Skip to content
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

gh api command does not connect to GitHub Enterprise Server #1942

Open
mzzmjd opened this issue Sep 24, 2020 · 2 comments
Open

gh api command does not connect to GitHub Enterprise Server #1942

mzzmjd opened this issue Sep 24, 2020 · 2 comments
Labels
bug

Comments

@mzzmjd
Copy link

@mzzmjd mzzmjd commented Sep 24, 2020

Describe the bug

When authenticated to a GitHub Enterprise Server and running the gh api user command, it always tries to connect to api.github.com rather than my Enterprise Server.

$ gh --version
gh version 1.0.0 (2020-09-16)
https://github.com/cli/cli/releases/tag/v1.0.0

Steps to reproduce the behavior

  1. Run the command gh api user
  2. The following output is displayed
$ gh api user
error connecting to api.github.com
check your internet connection or githubstatus.com
  1. See error above.
    Note: I get the above error connecting to api.github.com as my proxy server setting is not set. But it should not be connecting to api.github.com it should be connecting to https://my.enterprise.server/api

Expected vs actual behavior

I would expect it to connect to my enterprise server (https://my.enterprise.server/api) as the gh auth status shows:

$ gh auth status
my.enterprise.server
  Ô£ô Logged in to my.enterprise.server as mzzmjd (~/.config/gh/hosts.yml)
  Ô£ô Git operations for my.enterprise.server configured to use https protocol.

Logs

$ gh auth status
my.enterprise.server
  Ô£ô Logged in to my.enterprise.server as mzzmjd (~/.config/gh/hosts.yml)
  Ô£ô Git operations for my.enterprise.server configured to use https protocol.

$ gh api user
error connecting to api.github.com
check your internet connection or githubstatus.com
@mzzmjd mzzmjd added the bug label Sep 24, 2020
@mzzmjd
Copy link
Author

@mzzmjd mzzmjd commented Sep 24, 2020

Looks like you have to set the variable GH_HOST to use this with GitHub Enterprise Server

@mislav
Copy link
Member

@mislav mislav commented Sep 25, 2020

Yes! Sorry for not making this clearer. We are going to improve the documentation, as well as likely offer a --hostname flag for choosing a host for requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.