Authenticating gh with a Personal Access Token

While authenticating gh in WSL, running gh auth login opened the browser within WSL for device authorization. The device code was accepted, but the callback never returned to the CLI - the handshake hung indefinitely. Using a Personal Access Token (PAT) with --with-token sidesteps the browser flow entirely. Go to https://github.com/settings/tokens/new and generate a token. Choose an expiry that suits your needs (90 days is a reasonable default) and select the scopes you need. For general gh usage: ...

June 26, 2026