How to get functional again after "you must re-authorize the OAuth Application `GitHub for VSCode`"

Viewed 2993

So one fine day, I get an error message, trying to push to a remote repo: SAML SSO Error box

and in the Git Log can be found:

remote: The `<redacted>' organization has enabled or enforced SAML SSO. To access
remote: this repository, you must re-authorize the OAuth Application `GitHub for VSCode`.

Attempt #1: Search result

Search results for GitHub for VSCode point to: https://code.visualstudio.com/docs/editor/github which prompts to install/authorise a new extension: GitHub PRs and Issues (??)

I try, it adds a new extension, I authorize it, but still no joy trying to Push/Pull from remote!

Attempt #2: Logout

(GH PRs/Issues is still installed)

Then I try signing out (based on a SO answer for a similar SAML SSO error)

GitHub Sign Out - menu option

...but how do I sign back in now!? [My current window] already has repos linked, so the options below are missing:

Clone repo dialogs

Answer: new window... duh!

Login - still no joy ‍♂️

Attempt #3: de-/re-authorize from GH UI

  1. [top-right] Profile button -> Settings -> [Left menu] Applications -> [top-bar] Authorized OAuth Apps
  2. Scroll to GitHub for VSCode and click ... -> revoke
  3. Repeat log-in process from attempt #2
  4. Try to push: NEW ERROR! (Success! - well sort of...)

New Error

Next it complained about my credential.manager, which I had borked by trying commands from another SO post:

git config --global credential.helper <something I don't have>

Which I was able to recover by repeating the above command, re-using the credential.helper that I do have, from the key/value in git config -l.

Attempt #4: Permutations (?)

  • Re-revoke from GH UI (link in attempt #3)
  • Re-login via new window + Clone Repository
    • Re-using an old, empty window will complain Error:Bad Credential instead of restarting OAuth...
  • Nope...
2 Answers

SOOOOO it was a Code-18; and the crux lies in the OAuth flow screens.

THE FINAL Steps:

  1. Revoke authorization from GH UI (like in attempt #3)
  2. Sign out from VSCode UI + re-login via Clone a Repository (like in Attempt #2)
  3. PAY CLOSE ATTENTION TO THE OAUTH FLOW: Begin OAuth flow enter image description here

... Unfortunately I wasn't able to repro the critical screen (!?), but basically, it presented a list with:

  • a single item: my org-name, alongside a green Authorize button
  • another green Authorize button outside/under the list (possibly next to a refuse button)

NOTE: the text on the buttons is IIRC, since I wasn't able to get back to that exact screen...?

The key was to click on the Authorize beside the org-name, and NOT the one under the whole list, which I had been using to date

... time to get back to pushing commits!

Adding a note to this because it stumped me.

Not sure exactly what causes it, but if you're running VS Code and also have your git account authorized through Visual Studio, you may have to revoke access to Visual Studio and reauthorize it to continue using git from your VS Code terminal.

Hope this helps.

Related