gh auth token --hostname github.com

Category: GitHub CLI

gh auth token --hostname github.com

Print the auth token for a host

Outputs the OAuth token gh uses for github.com, which scripts and other tools can reuse. The token grants the same permissions as your gh login, so treat it like a password. --hostname selects among hosts when you have several accounts.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.