vscode-gitlens icon indicating copy to clipboard operation
vscode-gitlens copied to clipboard

Your 'github' credentials are either invalid or expired

Open tekumara opened this issue 3 years ago • 5 comments

  • GitLens Version: v12.1.1
  • Git Version: Run git --version
  • VSCode Version: 1.68.1
  • OS Version: macos

Steps to Reproduce:

  1. Connect to Github Enterprise, eg: settings
    "gitlens.remotes": [{ "domain": "github.acme.com", "type": "GitHub" }]
    
  2. Open git blame, connect to github and authorise

Gitlens is stuck in a loop where it will now keep popping up the

Your 'github' credentials are either invalid or expired. Would you like to try reauthenticating?

box, and the modal window:

Are you sure you want to disable
the rich integration with GitHub
(github.acme.com)?

Reauthenticating doesn't work, nor does disabling the integration. In either case, both dialogs will reappear.

tekumara avatar Jul 03 '22 05:07 tekumara

Did you find a solution?

asayagoo avatar Jul 13 '22 19:07 asayagoo

I think I might have stopped this behaviour, by disallowing the GitLens extension from accessing my (regular, non-enterprise) Github account:

image

image

image

After I removed the permission for GitLens to use my (regular, non-enterprise) Github account, I was no longer prompted to authenticate. I guess there's a bit of confusion/overlap between the (regular, non-enterprise) Github account as configured within VS Code itself, and the Github Enterprise account configuration specifically for GitLens. But that's just a guess.

jnpwly avatar Jul 21 '22 23:07 jnpwly

I think I might have stopped this behaviour, by disallowing the GitLens extension from accessing my (regular, non- After I removed the permission for GitLens to use my (regular, non-enterprise) Github account, I was no longer prompted to authenticate.

After doing that, and hovering on a line I get this image then when I click "Connect to GitHub", this dialog pops up: image I click "Allow", a browser window pops up and closes instantly, annnnd I'm back to square one 😢

EDIT: More info..it seems like GitLens is indeed trying to sign in to my personal account, then saying my credentials are invalid (which they are for my work account). So the real question is, how do we get GitLens to use the enterprise GitHub link to sign in instead of the public github.com?

rockboynton avatar Jul 22 '22 00:07 rockboynton

Rolling back to 12.1.0 resolved this for me.

bryankenote avatar Aug 01 '22 16:08 bryankenote

Sorry for all the trouble and confusion on this one. To get GitLens (or more accurately VS Code) to use GitHub Enterprise, You need to set github-enterprise.uri in your settings to the URL of your enterprise instance. But the stable version of GitLens (currently 12.1.2) doesn't yet support GitHub Enterprise -- you'll need to try the Insiders version of GitLens.

You can install the GitLens insiders edition from here.

Please be sure to disable or uninstall the stable version of GitLens first.

I am looking into ways to improve this auth flow, and avoid some of the confusion here -- since ideally you shouldn't get prompted to auth for a GitHub Enterprise remote, unless you have github-enterprise.uri or better we should guide you to set it.

eamodio avatar Aug 01 '22 17:08 eamodio

The latest insiders build changes the authentication for GHE to be completely controlled by GitLens to avoid the need for the github-enterprise.uri setting and to allow multiple GHE instances to be connected to at once. This should completely resolve this now.

eamodio avatar Aug 29 '22 03:08 eamodio

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

github-actions[bot] avatar Oct 02 '22 05:10 github-actions[bot]