Failing to authenticate on new wsl setup #6884
Replies: 20 comments 31 replies
-
|
Hi, thanks for reporting and sorry for the trouble. I have never seen this error before. The server error indicates that the authorization flow was polling the API too frequently, but that should never be the case because we get the polling interval (usually 5 seconds) from the server in the first place. Does this happen every time? You can do |
Beta Was this translation helpful? Give feedback.
-
|
fwiw, I just had the same issue and running with |
Beta Was this translation helpful? Give feedback.
-
|
similar situation, I'm now trying ubuntu 22.04 instead of 20.04 to see if it works |
Beta Was this translation helpful? Give feedback.
-
|
I just encountered this issue with gh 2.37.0 on freshly installed Ubuntu 22.04. My first attempt at
It appears the API is still waiting for me to paste in the first one-time code (which I no longer have). A way to cancel pending authorization request(s) would be nice. |
Beta Was this translation helpful? Give feedback.
-
|
Please check your clock in WSL environment. |
Beta Was this translation helpful? Give feedback.
-
|
Setting the time zone worked for me on nixOS |
Beta Was this translation helpful? Give feedback.
-
|
This is a problem with wrong time on WSL. To fix it, run this command: sudo hwclock -sor sudo ntpdate time.windows.com(See microsoft/WSL#5324 (comment)) If you have Ubuntu 24.04 or for some reason you don't have this command, you can install it: sudo apt install util-linux-extraIf the time is still incorrect, you may need to change the time zone: sudo timedatectl set-timezone <your timezone>You can view the list of time zones using this command: timedatectl list-timezonesAfter that, synchronize the time again and then everything should work 😉 |
Beta Was this translation helpful? Give feedback.
-
|
We're running into the same issue. Resetting clock doesn't work. Running with debug doesn't work. Steps to reproduce:
When running with debug we can see that the call is executed twice while we're doing things in the browser. But then once we've completed everything in the browser. We get the too many attempts... Full command I'm trying to run for completeness: Ubuntu 22.04 jammy installed using WSL |
Beta Was this translation helpful? Give feedback.
-
|
I ran into this problem today and found a simple workaround.
|
Beta Was this translation helpful? Give feedback.
-
|
Could we escalate this to an issue considering there's a reproducible case now and it seems like most WSL installs are impacted? The issue gets even worse if you have multiple GH accounts logged in, as it adds an extra step to the process. The known workaround proposed by @ikeyan and "just being fast enough" are not a solution to the problem. We're planning to use it as part of a large setup script that prepares a local environment for the user. The current timeout is too short for the average person (you need to basically speedrun logging in), and having to run the script multiple times may cause issues with commands that have already executed before. |
Beta Was this translation helpful? Give feedback.
-
|
For me the solution was that Ubuntu came with git installed, but a rather outdated version, and upgrading the version fixes it |
Beta Was this translation helpful? Give feedback.
-
|
Hello everyone, Tried almost all the solutions above, none worked. |
Beta Was this translation helpful? Give feedback.
-
|
Random thought and a bit of a long shot, but could it have any correlation to the "mirrored" networking type? Is anyone experiencing the issue without mirrored networking? Seems weird that it only affects WSL2 is all, even with the latest git version (2.47.0). |
Beta Was this translation helpful? Give feedback.
-
@dgibbard-cisco I was running mirrored networking on my WSL installation and I was having this problem. However, I see this comment says I tried turning mirrored mode back ON and the problem didn't come back (I did |
Beta Was this translation helpful? Give feedback.
-
|
hmm i received |
Beta Was this translation helpful? Give feedback.
-
|
I am not able to log in, I am getting these issues: $ gh auth login
? What account do you want to log into? GitHub.com
? What is your preferred protocol for Git operations on this host? HTTPS
? Authenticate Git with your GitHub credentials? Yes
? How would you like to authenticate GitHub CLI? Login with a web browser
! First copy your one-time code: 830D-A74C
Press Enter to open github.com in your browser...
gzip: stdin: not in gzip format # Error here# and when I later exit out of it Can't open history |
Beta Was this translation helpful? Give feedback.
-
|
managed to get it to work by doing these steps on wsl2 ubuntu 24.04.4, gh 2.89.0 :
it seems to work despite the error. hope this helps someone. |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
I'm in the process of setting up a new machine but in doing so I'm failing to authenticate with
gh auth login.Here's the terminal output:
In the browser though the auth process goes through correctly, I entered the code, I approved access to my account/orgs, and I was presented with the success screen, only to find my terminal having the error.
I appear to be on the latest release:
And the WSL version is:
Beta Was this translation helpful? Give feedback.
All reactions