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
- Ask your agent to run
gh auth loginagain. - Copy the new code, then open github.com/login/device yourself and paste it.
- Click Authorize, then ask your agent to run
gh auth status.
- Ask your agent to run
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.
Was this page helpful?