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

Support multiple GitHub accounts #109

Closed
marvint24 opened this issue May 24, 2023 · 14 comments
Closed

Support multiple GitHub accounts #109

marvint24 opened this issue May 24, 2023 · 14 comments
Assignees
Labels
feature-request Request for new features or functionality on-release-notes Issue/pull request mentioned in release notes on-testplan

Comments

@marvint24
Copy link

I use multiple GitHub accounts. One has access to GitHub Copilot and GitHub Copilot Chat, and the other one does not.

After installing the GitHub Copilot and GitHub Copilot Labs extensions, you are asked to sign in with your account.
After installing the GitHub Copilot Chat extension, you are not.

There is also no option to manage it under:

  1. image
  2. image
  3. image

At the moment, I only get this error message:
image

Please add an option to select the account.

@marvint24 marvint24 changed the title Support multiple Github accounts Support multiple GitHub accounts May 24, 2023
@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented May 26, 2023

Depends on microsoft/vscode#127967 and then the copilot extension will need to take advantage of this.

@Falven
Copy link

Falven commented Dec 22, 2023

This is a critical enterprise scenario... Data isolation of enterprise accounts, potentially even sensitive customer data. We have been waiting on this for months. Please prioritize this already.
It could easily be managed by the VS Code Trusted Extensions functionality if Copilot respected those settings.

@LogicDaemon
Copy link

LogicDaemon commented Dec 26, 2023

Depends on microsoft/vscode#127967 and then the copilot extension will need to take advantage of this.

but the main Copilot extension already works fine with a separate GitHub account! And even Copilot Labs worked.

Copilot Chat extension just ignores the account selected for Copilot and instead goes for the main account used in VS Code for settings sync!

I don't want to switch between VS Code profiles. I like having same settings at work and at home.

But I only have Copilot enabled for the work account, which I don't use at home.

@LogicDaemon
Copy link

Recently, the main Copilot extension started complaining about the github account and stopped working.

I ended up setting a separate Microsoft account just for VS Code settings sync.
This way, I can authenticate in Github with Copilot account at work, and keep the settings in a separate Microsoft account available on all my computers.

@Twoleeland
Copy link

Depends on microsoft/vscode#127967 and then the copilot extension will need to take advantage of this.

but the main Copilot extension already works fine with a separate GitHub account! And even Copilot Labs worked.

Copilot Chat extension just ignores the account selected for Copilot and instead goes for the main account used in VS Code for settings sync!

I don't want to switch between VS Code profiles. I like having same settings at work and at home.

But I only have Copilot enabled for the work account, which I don't use at home.

For now, it's a possible workaround for some developers, but not a “real” solution. About 1.5 years ago, syncing settings with Microsoft account was suddenly a problem. After days and weeks of people here on GitHub complaining about sync issues with MS accounts and MS not doing anything about it, I switched to GitHub sync. Since then, there have been no more problems with synchronizing settings.

Anyway, they should split Copilot-licensing from Copilot-settings or introduce a possibility to link private accounts to business accounts regarding the Copilot-licensing in some way.

@ian-h-chamberlain
Copy link

Now that microsoft/vscode#222131 has merged in VSCode, is there a plan to implement support for it in this extension? I still have not found a reliable way to use a different account for GitHub Pull Requests vs this extension, particularly after some of the changes around #1444 (I guess github.copilot.preferredAccount is not supposed to be set at all, confusingly?)

@TylerLeonhardt
Copy link
Member

@ian-h-chamberlain have you tried:

"github.experimental.multipleAccounts": true
  • Signing in to GH PR with account 1
  • Setting:
"github.copilot.preferredAccount":"YOUR ACCOUNT 2 USERNAME"
  • Signing in to GitHub Copilot Chat with account 2?

@ian-h-chamberlain
Copy link

@TylerLeonhardt I just tried these steps; I guess maybe my order of operations was part of the problem before?

  1. Configure github.experimental.multipleAccounts to true
  2. Signed out of all accounts
  3. Deleted preferredAccount from configuration
  4. Sign into to GH PR extension
  5. Configured preferredAccount with my company-provisioned username $companyUser
  6. Sign into GH Copilot + Copilot Chat

Now, Copilot Chat works as expected but not Copilot itself, with several of these logs in its output channel:

2024-09-09 13:06:07.000 [info] [auth] Invalid copilot token: missing token: 403 
2024-09-09 13:06:07.026 [info] [auth] Invalid copilot token: missing token: 403 

I can see that Chat is using the correct account name, but Copilot is not, based on the timestamps in the "trusted extension" view:

GH PR account (ian-h-chamberlain (GitHub))

Screenshot 2024-09-09 at 13 09 49

preferredAccount with Copilot license ($companyUser (GitHub))

Screenshot 2024-09-09 at 13 09 42

There also appears to be a third account $companyUser (GitHub Copilot Chat) which has no extensions associated with it:
Screenshot 2024-09-09 at 13 15 25

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Sep 9, 2024

Couple things here that would fix the issue for you:

  • Copilot (not Chat) doesn't honor the preferredAccount setting yet... it should and we're going to adopt it there... working with the right folks to do that work
  • This issue Allow a user to update auth session preference vscode#225943 should also probably fix the issue for you, which I'm working on this month

What you could do right now... is maybe something like this:

  1. Configure github.experimental.multipleAccounts to true
  2. Sign out of all GitHub accounts
  3. Sign in to GitHub Copilot with the correct account
  4. Sign in to GitHub Pull Request with its correct account
  5. set preferredAccount
  6. Sign in to GitHub Copilot Chat with the correct account

Let me know if that works for you.

@ian-h-chamberlain
Copy link

  1. Sign in to GitHub Copilot with the correct account
  2. Sign in to GitHub Pull Request with its correct account

I think this is the part where it becomes problematic... after sign-in it presents this prompt:

Screenshot 2024-09-09 at 14 07 19

  1. Click Allow:

    Once the second sign-in from the above prompt completes, there seems to be no way to separately sign into GitHub Pull Request, because they are treated under the same "GitHub" umbrella?

    GitHub Pull Requests: Sign in to GitHub has no effect at this point, which I guess is maybe due to GHPR not supporting multiple accounts either (Uses the wrong account when signed in with multiple GitHub.com accounts vscode-pull-request-github#5159, Support multiple GitHub accounts vscode-pull-request-github#3595)

  2. Click Cancel:

    Both Copilot and Chat seem to work correctly at first. Proceeding to steps 4-6 sort of seems to work at this point? Although I didn't need to re-sign in at step 6 because chat already appeared to be enabled correctly.

    However, Copilot completions working seems to be temporary; I'm presented with this immediately
    Screenshot 2024-09-09 at 14 09 53
    although it seems to be kind of a mistaken warning at first. After reloading the VSCode window, the warning appears again and completions stops working.

    Chat authentication seems to persist across a reload.


I'm glad to hear there is planned work being done here! I think Copilot (not Chat) using preferredAccount would likely solve this, although it might be worth posing a similar idea to the GH Pull Requests folks for that extension just to make everything explicit. Maybe some kind of top-level github.preferredAccount as a fallback would make sense too, as part of the experimental.multipleAccounts feature?

@TylerLeonhardt
Copy link
Member

Update in Core:
microsoft/vscode#127967 (comment)

Actually I think with that change, this should be supported.

@claidler
Copy link

claidler commented Sep 24, 2024

Update in Core: microsoft/vscode#127967 (comment)

Actually I think with that change, this should be supported.

This resolves the issue for me! Thank you.

Update - it works, but you have to change it every time you open/close VSCode it seems, which is a little bit annoying.

@TylerLeonhardt
Copy link
Member

@claidler you shouldn't have to do that and I don't repro that behavior. Can you open a new issue please with some solid steps that you follow?

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Sep 25, 2024

Closing this issue since the feature is resolved (covered by test plan microsoft/vscode#229420)

@TylerLeonhardt TylerLeonhardt added on-testplan on-release-notes Issue/pull request mentioned in release notes labels Sep 25, 2024
@vs-code-engineering vs-code-engineering bot locked and limited conversation to collaborators Nov 9, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality on-release-notes Issue/pull request mentioned in release notes on-testplan
Projects
None yet
Development

No branches or pull requests

7 participants