Setup

gh auth login doesn't open the browser, or the code expires

What you see
The login page never opens, or GitHub says the one-time code is invalid.
Why it happens
The code lasts a few minutes, and some setups can't open the browser on their own.
How to fix it
  1. Ask your agent to run gh auth login again.
  2. Copy the new code, then open github.com/login/device yourself and paste it.
  3. Click Authorize, then ask your agent to run gh auth status.

Message for your agent

`gh auth login` didn't work. Run it again with GitHub.com, HTTPS and the web browser option, tell me the code, and wait while I paste it at github.com/login/device.

Tip

How to prevent it: Paste the code right away; it expires quickly.

Still stuck?Report it to your agent, clearly

Hands-on test on Mac and Windows pending · Last reviewed Nov 8, 2026