Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uses the wrong account when signed in with multiple GitHub.com accounts #5159

Open
ahmetb opened this issue Aug 7, 2023 · 10 comments · May be fixed by #5699
Open

Uses the wrong account when signed in with multiple GitHub.com accounts #5159

ahmetb opened this issue Aug 7, 2023 · 10 comments · May be fixed by #5699
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug
Milestone

Comments

@ahmetb
Copy link

ahmetb commented Aug 7, 2023

  • Extension version: v0.70.0
  • VSCode Version: 1.82.0-insider
  • OS: macOS 13.5 (22G74)

Steps to Reproduce:

  1. Have a remote like this (in my case, it's accessible only behind VPN, which I'm already on)

    origin	ssh://[email protected]/y/k8s-sidecar-operator.git (fetch)
    origin	ssh://[email protected]/y/k8s-sidecar-operator.git (push)
    
  2. I'm signed into VSCode with both my personal & work github accounts (they're both for github.com:

    image
  3. Go to Github Pull Requests extension pane, observe error:

    Fetching pull requests for remote origin, please check if the url ssh://[email protected]/y/k8s-sidecar-operator.git is valid.

    Screenshot:

    Untitled

  4. Developer logs show it's failing to find the repo:

     2023-08-07 11:58:23.403 [info] Review> No matching pull request metadata found locally for current branch juzeng/sidecar-logics
     2023-08-07 11:58:23.403 [info] Review> no matching pull request metadata found for current branch juzeng/sidecar-logics
     2023-08-07 11:58:23.834 [error] GitHubRepository> Fetching all pull requests failed: HttpError: Not Found
     2023-08-07 11:58:23.835 [error] GitHubRepository> Unable to fetch issues: Error: GraphQL error: Could not resolve to a Repository with the name 'ORGNAME_REDACTED/k8s-sidecar-operator'.
     2023-08-07 11:58:23.835 [error] GitHubRepository> Unable to fetch issues: Error: GraphQL error: Could not resolve to a Repository with the name 'ORGNAME_REDACTED/k8s-sidecar-operator'.
     2023-08-07 11:58:24.335 [warning] GitHubRepository> Fetching default branch failed: HttpError: Not Found
     2023-08-07 11:58:24.351 [error] GitHubRepository> Unable to fetch issues without milestone: Error: GraphQL error: Could not resolve to a Repository with the name 'ORGNAME_REDACTED/k8s-sidecar-operator'.
     2023-08-07 11:58:24.351 [error] GitHubRepository> Unable to fetch issues without milestone: Error: GraphQL error: Could not resolve to a Repository with the name 'ORGNAME_REDACTED/k8s-sidecar-operator'.
     2023-08-07 11:58:24.403 [warning] GitHubRepository> Fetching default branch failed: HttpError: Not Found
     2023-08-07 11:58:24.786 [warning] GitHubRepository> Fetching default branch failed: HttpError: Not Found
    
  5. In the meanwhile, commands like git fetch or gh pr create work fine with this remote.

I'm suspecting the extension is using my personal GitHub.com account on the work repo. Is there a way for the extension to hint/guess which account to use (or configure explicitly)?


Some other configs if relevant at all:

$ git config -l | grep remote
remote.origin.url=ssh://[email protected]/y/k8s-sidecar-operator.git
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.ahmet/mybranchname.remote=origin
$ git config -l | grep ssh
credential.ssh://github.com.helper=!gh auth git-credential
remote.origin.url=ssh://[email protected]/y/k8s-sidecar-operator.git
@ahmetb ahmetb changed the title SSH remote is not recognized as valid Remote not recognized as valid when signed in using multiple GitHub accounts Aug 7, 2023
@ahmetb ahmetb changed the title Remote not recognized as valid when signed in using multiple GitHub accounts Uses the wrong account when signed in with multiple GitHub.com accounts Aug 7, 2023
@alexr00 alexr00 self-assigned this Aug 17, 2023
@alexr00 alexr00 added this to the September 2023 milestone Aug 17, 2023
@alexr00
Copy link
Member

alexr00 commented Aug 17, 2023

It's not ideal, but does this work if you sign out of your personal account?

@ahmetb
Copy link
Author

ahmetb commented Aug 18, 2023

It probably would but if I did that, I wouldn't be able to use Settings Sync also relies on this GitHub sign in feature, right?

@alexr00
Copy link
Member

alexr00 commented Aug 18, 2023

I think you can also use a Microsoft account for settings sync, but once again, this isn't ideal. I'm going to take a look at this in September and I expect I'll have a fix for you then.

@alexr00 alexr00 modified the milestones: September 2023, October 2023 Sep 25, 2023
@alexr00 alexr00 modified the milestones: October 2023, November 2023 Oct 25, 2023
@alexr00 alexr00 modified the milestones: November 2023, December 2023 Nov 24, 2023
@venatiodecorus
Copy link

Just ran into this again myself, patiently waiting :)

@joaomoreno joaomoreno removed this from the December 2023 milestone Dec 11, 2023
@alexr00 alexr00 added this to the December / January 2024 milestone Dec 11, 2023
@joaomoreno joaomoreno added the bug Issue identified by VS Code Team member as probable bug label Dec 14, 2023
@alexr00 alexr00 modified the milestones: December / January 2024, February 2024 Jan 24, 2024
@alexr00
Copy link
Member

alexr00 commented Jan 30, 2024

I took a look at this and started implementing it, only to realize that first microsoft/vscode#127967 needs to be done. Once the upstream issue is addressed I'll come back to this bug!

@joseph-skupniewicz-sp
Copy link

I'm also seeing this when I try to sign in with a different github account, after pasting in the code (in the logged in session in the new account)

image

@alexr00
Copy link
Member

alexr00 commented Mar 26, 2024

Only 1 account at a time is supported at the moment. You'll need to sign out of your first account before signing in with a second one. @TylerLeonhardt FYI for the error.

@zioalex
Copy link

zioalex commented Apr 6, 2024

Thanks @alexr00 for the info. Can we make it support multiple accounts?

@alexr00
Copy link
Member

alexr00 commented Apr 8, 2024

@TylerLeonhardt is working on the first steps of getting multiple account support going.

@tekton-marty
Copy link

Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
7 participants