Skip to content

Text missing in the description of GH_TOKEN #11294

Description

@SpecLad

Describe the bug

In the online version of the documentation, the domain names are missing from the description of the GH_TOKEN environment variable.

Affected version

N/A - this is for the online version.

Steps to reproduce the behavior

  1. Go to https://cli.github.com/manual/gh_help_environment
  2. Read the first paragraph.
  3. It says "an authentication token that will be used when a command targets either or a subdomain of ."

Expected vs actual behavior

It should say "an authentication token that will be used when a command targets either <github.com> or a subdomain of <ghe.com>."

Logs

N/A

Activity

  1. williammartin commented on Jul 14, 2025

    @williammartin
    Member

    Huh, I guess the <> result in the text being rendered out here:

    %[1]sGH_TOKEN%[1]s, %[1]sGITHUB_TOKEN%[1]s (in order of precedence): an authentication token that will be used when
    a command targets either <github.com> or a subdomain of <ghe.com>. Setting this avoids being prompted to
    authenticate and takes precedence over previously stored credentials.

    We should probably check the others here as well: #10429

    Thanks a lot for reporting!

  2. andyfeller commented on Jul 14, 2025

    @andyfeller
    Contributor

    I think the problem is <hostname.domain> has no protocol, thus the transformation to GitHub Pages doesn't link them the same as say GLAMOUR_STYLE environment variable:

    • GH_TOKEN

      <p><code class="language-plaintext highlighter-rouge">GH_TOKEN</code>, <code class="language-plaintext highlighter-rouge">GITHUB_TOKEN</code> (in order of precedence): an authentication token that will be used when
      --
      a command targets either <github.com> or a subdomain of <ghe.com>. Setting this avoids being prompted to
      authenticate and takes precedence over previously stored credentials.</ghe.com></github.com></p>
    • GLAMOUR_STYLE

      <p><code class="language-plaintext highlighter-rouge">GLAMOUR_STYLE</code>: the style to use for rendering Markdown. See
      --
      <a href="https://github.com/charmbracelet/glamour#styles">https://github.com/charmbracelet/glamour#styles</a></p>

    Additional instances

    Unsure if this was just a problem with <github.com> and <ghe.com>, I did a bit of digging to look for anything like <hostname.domain> but wasn't able to find anything else:

    ./pkg/cmd/extension/command.go:303:					The URL format is useful when the repository is not hosted on <github.com>.
    ./pkg/cmd/auth/login/login.go:98:			# Authenticate against <github.com> by reading the token from a file
    ./pkg/cmd/search/code/code.go:43:			The results might not match what is seen on <github.com>, and new features like regex search
    ./pkg/cmd/root/help_topic.go:46:			a command targets either <github.com> or a subdomain of <ghe.com>. Setting this avoids being prompted to
    ./pkg/cmd/api/api.go:204:				<github.com> API requests.
    ./pkg/cmd/api/api.go:209:				GH_HOST: make the request to a GitHub host other than <github.com>.
    ./pkg/cmd/repo/rename/rename.go:62:			you must follow additional steps on <github.com>.

    So here are all the <github.com> and <ghe.com> references:

    $ grep -rn "<\(github\|ghe\).com>" --exclude-dir site --exclude-dir .git .
    ./acceptance/testdata/repo/repo-rename-transfer-ownership.txtar:6:stderr 'New repository name cannot contain \''/\'' character - to transfer a repository to a new owner, you must follow additional steps on <github.com>. For more information on transferring repository ownership, see <https://docs.github.com/en/repositories/creating-and-managing-repositories/transferring-a-repository>.'
    ./pkg/cmd/extension/command.go:303:					The URL format is useful when the repository is not hosted on <github.com>.
    ./pkg/cmd/auth/login/login.go:98:			# Authenticate against <github.com> by reading the token from a file
    ./pkg/cmd/search/code/code.go:43:			The results might not match what is seen on <github.com>, and new features like regex search
    ./pkg/cmd/root/help_topic.go:46:			a command targets either <github.com> or a subdomain of <ghe.com>. Setting this avoids being prompted to
    ./pkg/cmd/api/api.go:204:				<github.com> API requests.
    ./pkg/cmd/api/api.go:209:				GH_HOST: make the request to a GitHub host other than <github.com>.
    ./pkg/cmd/repo/rename/rename.go:62:			you must follow additional steps on <github.com>.
    ./pkg/cmd/repo/rename/rename.go:129:		return fmt.Errorf("New repository name cannot contain '/' character - to transfer a repository to a new owner, you must follow additional steps on <github.com>. For more information on transferring repository ownership, see <https://docs.github.com/en/repositories/creating-and-managing-repositories/transferring-a-repository>.")
    ./pkg/cmd/repo/rename/rename_test.go:230:			errMsg:  "New repository name cannot contain '/' character - to transfer a repository to a new owner, you must follow additional steps on <github.com>. For more information on transferring repository ownership, see <https://docs.github.com/en/repositories/creating-and-managing-repositories/transferring-a-repository>.",
  3. self-assigned this
    on Jul 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggh-helprelating to the gh help commandneeds-triageneeds to be reviewed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions