Skip to content

gh auth setup-git requires a login #8521

@jtnord

Description

@jtnord

Describe the bug

gh auth setup-git should be used to configure the github credential helper (basically git config --global credential.https://github.com.helper !'$PATH_TO_GH.EXE' auth git-credential however the command fails with You are not logged into any GitHub hosts. Run gh auth login to authenticate.

as the command is purely configuring git there should be no requirement for it to be logged in. this causes pain where the command is being run to pre-setup developer environments but leaves the login to the user at a later date (when it is needed)

gh version 2.40.1 (2023-12-13)
https://github.com/cli/cli/releases/tag/v2.40.1

Steps to reproduce the behavior

  1. on a clean machine download and install but do not configure git and gh
  2. gh auth setup-git --hostname github.com
  3. git config --global -l

Expected vs actual behavior

the command in step 2 runs without error
the command in step 3 shows that the helper has been added

Actual behaviour is the second command fails

> gh auth setup-git --hostname github.com
You are not logged into any GitHub hosts. Run gh auth login to authenticate.

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggh-authrelating to the gh auth commandhelp wantedContributions welcomep3Affects a small number of users or is largely cosmetic

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions