You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Authenticate without a manually-created token and without a browser #14089
PATs aren't a good solution because they take more effort: you have to go to the GitHub settings, pick the permissions, choose an expiry date, and do that again when they expire. They can't be short-lived without adding refresh burden, especially when working in multiple containers, machines, etc. The CLI login flow is better for that.
This is the fastest way to log into GitHub CLI without managing tokens by hand.
Additional context
This was closed due to the possibility of pasting a Personal Access Token, but that's not the same thing. You have to create and refresh them manually, you have to pick the permissions manually, they expire, etc.
Thanks for the suggestion! I'm classifying this as an enhancement and suggesting the enhancement and gh-auth labels, since it proposes a new --no-browser flag for gh auth login to skip the browser-open step and just print the device code/URL for manual/headless completion.
This is closely related to prior discussions on headless/browser-less login (#5500 "Login with a web browser on headless machine", closed as completed) and other recent reports about SSH/WSL/headless auth UX, but it's not an exact duplicate — those focused on general headless detection or workarounds (e.g. GH_BROWSER=/bin/true), while this specifically proposes a documented --no-browser flag. A maintainer may want to confirm whether existing workarounds (like setting GH_BROWSER to a no-op command) already satisfy this need or whether a first-class flag is warranted.
Thanks. What happens if you do something like GH_BROWSER=wslview gh auth login?
Press Enter to open https://github.com/login/device in your browser...
! Failed opening a web browser at https://github.com/login/device
exec: "wslview": executable file not found in $PATH
Please try entering the URL in your browser manually
If I Ctrl+click the URL and finish the login flow in my Windows browser, the CLI seems to require me to press Enter again to react to it, then login succeeds.
(Same person, different account.) I change environments often at work so it wouldn't be one-time, it would be WSL on system 1, WSL on system 2, dev containers 1 to 10, etc. It would also be the systems of people on my team that I sometimes do support for and who have less experience with this.
It would be much easier to be able to say "run gh auth login --no-browser, open the link, follow the forms and you're done" than to explain how to set up a browser handler.
In general, I think it's better to support a simple, slightly more manual method than to force an automatic process that requires more reading and setup just to get past.
Thank you for your issue! We have categorized it as an enhancement (feature or improvement) request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.
Unless you see the
help wantedContributions welcome
label, we are not currently looking for external contributions for this feature.
If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.
Activity
cli-triage commentedon Aug 6, 2026
Caution
agentic threat detected
Threat detection flagged this output in warn mode. Manual review is REQUIRED before any follow-up automation.
Details
Potential security threats were detected in the agent output.
Review the workflow run logs for details.
Thanks for the suggestion! I'm classifying this as an enhancement and suggesting the
enhancementandgh-authlabels, since it proposes a new--no-browserflag forgh auth loginto skip the browser-open step and just print the device code/URL for manual/headless completion.This is closely related to prior discussions on headless/browser-less login (#5500 "Login with a web browser on headless machine", closed as completed) and other recent reports about SSH/WSL/headless auth UX, but it's not an exact duplicate — those focused on general headless detection or workarounds (e.g.
GH_BROWSER=/bin/true), while this specifically proposes a documented--no-browserflag. A maintainer may want to confirm whether existing workarounds (like settingGH_BROWSERto a no-op command) already satisfy this need or whether a first-class flag is warranted.williammartin commentedon Aug 6, 2026
Hey @ArnoGW1, can you say a little bit more about:
What does this actually mean? Can you take a screenshot?
ArnoGW1 commentedon Aug 6, 2026
After hitting Enter (and validating a cookie prompt in the same browser):

It's the Lynx browser. There might be a way to change the default, make it handle that page correctly, let
ghopen the Windows browser from WSL, etc. but that's not worth the effort compared to Ctrl+Click on the https://github.com/login/device URL in the prompt thatghshows.williammartin commentedon Aug 6, 2026
Thanks. What happens if you do something like
GH_BROWSER=wslview gh auth login?ArnoGW1 commentedon Aug 6, 2026
If I Ctrl+click the URL and finish the login flow in my Windows browser, the CLI seems to require me to press Enter again to react to it, then login succeeds.
williammartin commentedon Aug 6, 2026
It think like it would be fine to support
--no-browsergenerally, but it does seem like it would be easier if you one time set up a handler so that one of these providers is configured correctly: https://github.com/cli/browser/blob/main/browser_linux.go#L9 (or setGH_BROWSERto the path of your browser). Is there some reason you don't want to do that?a-gn commentedon Aug 6, 2026
(Same person, different account.) I change environments often at work so it wouldn't be one-time, it would be WSL on system 1, WSL on system 2, dev containers 1 to 10, etc. It would also be the systems of people on my team that I sometimes do support for and who have less experience with this.
It would be much easier to be able to say "run
gh auth login --no-browser, open the link, follow the forms and you're done" than to explain how to set up a browser handler.In general, I think it's better to support a simple, slightly more manual method than to force an automatic process that requires more reading and setup just to get past.
github-actions commentedon Aug 9, 2026
Thank you for your issue! We have categorized it as an enhancement (feature or improvement) request, and it has been added to our backlog. In doing so, we are not committing to implementing this feature at this time, but, we will consider it for future releases based on community feedback and our own product roadmap.
Unless you see the help wantedContributions welcome
label, we are not currently looking for external contributions for this feature.
If you come across this issue and would like to see it implemented, please add a thumbs up! This will help us prioritize the feature. Please only comment if you have additional information or viewpoints to contribute.
babakks commentedon Aug 9, 2026
I like the idea of
--no-browserflag, which should just print the URL and start polling for the token.babakks commentedon Aug 9, 2026
By the way, if you run
auth loginin non-tty mode (e.g.gh auth login |& cat) the browser path is not going to be taken.