Where Does GitHub CLI Store Hosts and Tokens?
GitHub CLI ~/.config/gh hosts.yml auth file on every OS plus per repo .git config entries.
Last updated
GitHub CLI stores host logins in hosts.yml under a gh folder in .config (AppData Roaming on Windows). Tokens may also live in the OS keychain depending on setup.
The auth status command shows which account and protocol each host uses. Repo level credential helpers in .git/config can override the global login per clone.
Where GitHub CLI stores this, by platform
%APPDATA%\GitHub CLI
hosts.yml inside. Older builds used %USERPROFILE%\.config\gh instead; the one holding hosts.yml is live.
~/.config/gh/hosts.yml
Same file layout. Tokens often sit in Keychain with gh as the account name.
~/.config/gh/hosts.yml
Same layout. XDG_CONFIG_HOME moves it when set. Keep permissions owner only.
Frequently asked questions
How do I log out GitHub CLI completely?
Run the auth logout per host, then delete hosts.yml. Keychain entries may need separate removal.
How do I use two GitHub accounts with gh?
Add both hosts entries and switch per repo with the auth switch flow, or scope credential helpers per clone.
Notice an outdated path? Let us know.