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 <anything> hangs after completion for ~30 seconds #6867

Open
jbrwilkinson opened this issue Jan 16, 2023 · 5 comments
Open

gh <anything> hangs after completion for ~30 seconds #6867

jbrwilkinson opened this issue Jan 16, 2023 · 5 comments
Labels
discuss Feature changes that require discussion primarily among the GitHub CLI team

Comments

@jbrwilkinson
Copy link

Describe the bug

When I issue any command at all, even gh --help and gh --version, the command line waits a long time (~30 seconds) before returning control to the user.

Steps to reproduce the behaviour

on macOS

  1. brew upgrade gh
  2. gh --version

..waits ~30 seconds before returning control.

Expected vs actual behaviour

It should execute the command, printing the output and any errors, then stop without waiting.

Logs

Paste the activity from your command line. Redact if needed.

% env | grep PAGER
% echo $SHELL
/bin/zsh
% system_profiler SPSoftwareDataType
Software:

    System Software Overview:

      System Version: macOS 12.6.2 (21G320)
      Kernel Version: Darwin 21.6.0
.....snipped....
% time gh --version
gh version 2.21.2 (2023-01-03)
https://github.com/cli/cli/releases/tag/v2.21.2
gh --version  0.05s user 0.01s system 0% cpu 30.057 total
@jbrwilkinson jbrwilkinson added the bug Something isn't working label Jan 16, 2023
@cliAutomation cliAutomation added the needs-triage needs to be reviewed label Jan 16, 2023
@jbrwilkinson jbrwilkinson changed the title gh <anything> does not finish; have to CTRL+C gh <anything> hangs after completion for ~30 seconds; have to CTRL+C Jan 16, 2023
@jbrwilkinson jbrwilkinson changed the title gh <anything> hangs after completion for ~30 seconds; have to CTRL+C gh <anything> hangs after completion for ~30 seconds Jan 16, 2023
@jbrwilkinson
Copy link
Author

% time gh --help
Work seamlessly with GitHub from the command line.
...
  Use 'gh <command> <subcommand> --help' for more information about a command.
  Read the manual at https://cli.github.com/manual

gh --help  0.05s user 0.02s system 0% cpu 30.058 total

@jbrwilkinson
Copy link
Author

env http_proxy=<internet Proxy> time gh --version
gh version 2.21.2 (2023-01-03)
https://github.com/cli/cli/releases/tag/v2.21.2
        0.05 real         0.04 user         0.01 sys

Looks like gh is trying to hit the internet even for --version

@mislav
Copy link
Member

mislav commented Jan 17, 2023

Looks like gh is trying to hit the internet even for --version

Yes, to check for newer versions of itself. It does that only once per 24 hours.

To disable this behavior, set export GH_NO_UPDATE_NOTIFIER=true in your environment. Note, however, that most other gh commands need the network to make API requests.

Closing since this is a problem with proxy networking.

@mislav mislav closed this as completed Jan 17, 2023
@jbrwilkinson
Copy link
Author

@mislav Many GitHub Enterprise users work in an environment where access to the internet isn't a given; when tools need updating, they'd run the update mechanism specifically, e.g. apt-get update or similar. Normal (non-update) workflow would not be expected to reach out to the internet.

Could the decision to check for updates be gated on the remote url containing GitHub.com?

@mislav
Copy link
Member

mislav commented Jan 17, 2023

We'd want users to stay up to date even if they're using gh to exclusively communicate with non-GitHub.com hosts, so to pay attention to git remotes would be a no go in my view. However, I do understand that some people prefer to use their package manager (like apt-get) to check for updates instead of the software to "phone home" to try to check itself.

Right now, the only ways to prevent gh from "phoning home" is to either:

  1. Set the environment GH_NO_UPDATE_NOTIFIER variable;
  2. Compile gh from source.

Do you think that our official deb & RPM packaged-gh should never contact github.com server by default?

@mislav mislav reopened this Jan 17, 2023
@mislav mislav added discuss Feature changes that require discussion primarily among the GitHub CLI team and removed bug Something isn't working needs-triage needs to be reviewed labels Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss Feature changes that require discussion primarily among the GitHub CLI team
Projects
None yet
Development

No branches or pull requests

3 participants