Skip to content

Confusing error when using GH_ENTERPRISE_TOKEN if gh auth login was never used.  #3522

@dragomirtitian

Description

@dragomirtitian

Describe the bug

On a fresh install of gh, if you don't run ever gh auth login and you use GH_ENTERPRISE_TOKEN instead, you get a confusing error message when running most, but not all commands: could not find hosts config: not found.

This is because the %userprofile%\.config\gh\ folder and it's content never gets created.

Steps to reproduce the behavior

Without ever having run gh auth login:

$env:GH_ENTERPRISE_TOKEN="<TOKEN>"
cd <some_repo>
gh pr create --title "Test PR" --body "test"
could not find hosts config: not found

Expected vs actual behavior

Either for the command to work, or an error message requiring the use of gh auth login

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority-2Affects more than a few users but doesn't prevent core functions

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions