Sub topic 4
Sign in with your GitHub account
Installing the extension does not give you suggestions. Copilot checks your GitHub identity first, then asks GitHub whether that account has an active Copilot entitlement. This chapter covers how that sign-in works in VS Code, how to confirm it succeeded, and how to sign out, switch accounts, and handle enterprise setups.
Prerequisites
This chapter assumes you have:
- Installed the GitHub Copilot extension (the previous chapter). The GitHub Copilot Chat extension is also installed, either alongside it or bundled with it, depending on your VS Code version.
- A GitHub account. A Copilot Free account is enough to follow along.
- Basic familiarity with the VS Code Activity Bar, status bar, and Command Palette.
What sign-in does
VS Code has a built-in authentication layer. Extensions do not ask for your password. They request a session from an authentication provider, and the built-in GitHub provider handles the login. Copilot asks that provider for a session with the scopes it needs, then uses the resulting token to call GitHub's Copilot services.
Three separate things happen, and it helps to keep them apart when troubleshooting:
- Authentication. GitHub confirms who you are.
- Authorization. You approve the "Visual Studio Code" OAuth app to act on your behalf.
- Entitlement. GitHub checks whether that account has Copilot through a plan, an organization seat, or the free tier.
Sign-in can succeed on steps 1 and 2 and still leave Copilot unusable because of step 3. The most common cause is signing in with the wrong account.
Sign in step by step
You can start sign-in from several places. They all lead to the same flow.
- Open the Accounts menu, the person icon at the bottom of the Activity Bar.
- Choose Sign in with GitHub to use GitHub Copilot. If you have no session yet, the Copilot icon in the status bar or the Chat view shows a sign-in button.
- VS Code opens your default browser at a GitHub page. Sign in there if you are not already, including any two-factor step.
- GitHub shows an authorization page for Visual Studio Code. Review the requested access and select Authorize Visual Studio Code.
- The browser asks to open VS Code. Allow it. The browser hands the result back through a
vscode://link, so your browser must be allowed to open that link. - Back in VS Code, the Accounts menu now shows your GitHub username, and the Copilot status bar item stops showing a warning.
Confirm that it worked
Do not assume the sign-in worked. Check these three things:
- Accounts menu. It lists your GitHub username. If the name is not the account you expected, sign out and repeat the flow (see below).
- Status bar. The Copilot icon should show no error or warning. Selecting it opens a status panel with the current state, and in some versions your usage and quota.
- A real suggestion. Open a scratch file and type a comment followed by a function signature. A gray inline suggestion should appear within a second or two. If it does not, the troubleshooting chapter has a longer checklist.
If you signed in without a paid plan, newer VS Code versions enroll you in Copilot Free, which has monthly limits on completions and chat messages. Seeing a "limit reached" message therefore means sign-in worked and the problem is quota, not authentication.
Which account is in use
VS Code can hold sessions for more than one GitHub account at once. The Accounts menu lists each one. Two situations cause confusion:
- Personal and work accounts. You may be signed in with a personal account that has no Copilot, while your work account holds the seat. Copilot will use the account that was granted to the extension, not necessarily the one you are thinking of.
- Multiple extensions using GitHub. The GitHub Pull Requests extension, Settings Sync, and Copilot all use the same provider, but each extension is granted access to a particular account separately.
To see and change which accounts an extension may use, open the Accounts menu, select your account name, and choose Manage Trusted Extensions. A checkbox list shows which extensions can use that account. GitHub Copilot should be ticked for the account that has the entitlement.
| Task | Where to do it |
|---|---|
| See signed-in accounts | Accounts menu in the Activity Bar |
| Allow or block extensions for an account | Accounts menu, account name, **Manage Trusted Extensions** |
| Sign out of one account | Accounts menu, account name, **Sign Out** |
| Add another account | Accounts menu, **Sign in with GitHub** or the Command Palette entry for signing in |
| Revoke the OAuth app on GitHub's side | GitHub **Settings**, **Applications**, authorized OAuth apps |
Sign out and switch accounts
To switch accounts, sign out of the wrong one first. Otherwise VS Code may silently reuse the existing session.
- Open the Accounts menu and select the wrong account.
- Choose Sign Out and confirm.
- Open the Accounts menu again and sign in. When the browser opens, check which GitHub account the page shows before you authorize. If the wrong one appears, use GitHub's account switcher or sign out on github.com first.
- Reload the window with the Command Palette command Developer: Reload Window if Copilot still reports the old state.
Signing out in VS Code removes the local session. It does not remove the authorization on GitHub. To revoke that, go to GitHub Settings, then Applications, find Visual Studio Code among the authorized apps, and revoke it. Do this if you used a shared or borrowed machine.
Teams and enterprise accounts
If your Copilot seat comes from an organization, the seat belongs to your personal GitHub account, and the organization assigns it. Two details matter:
- Organization policies apply after sign-in. An admin can block features such as suggestions that match public code, or disable chat. If a feature is missing after a successful sign-in, a policy may be the cause. This is not a sign-in failure.
- Single sign-on. If your organization enforces SAML single sign-on, you may need to authorize the OAuth app for that organization on GitHub's authorization page before the seat is recognized.
For GitHub Enterprise Cloud with data residency or a self-hosted GitHub Enterprise Server, VS Code must be told which server to authenticate against. The built-in setting is github-enterprise.uri:
{
"github-enterprise.uri": "https://example.ghe.com"
}Replace the URL with your company's host. Some versions also need the Copilot extension pointed at the enterprise provider. Follow your administrator's instructions or the current Copilot documentation for that part, since the exact setting has changed between releases.
Common sign-in failures
| Symptom | Likely cause | What to try |
|---|---|---|
| Browser opens but VS Code never receives the result | The browser blocked the `vscode://` link, or a different VS Code build handles it | Allow the browser prompt. Close other VS Code builds (such as Insiders) and retry |
| Sign-in loops back to the sign-in prompt | A stale session, or the extension is not trusted for the account | Sign out, reload the window, sign in again, then check **Manage Trusted Extensions** |
| Signed in, but Copilot says you have no access | The account has no seat or plan | Check the account name in the Accounts menu, then check your plan on GitHub |
| Authorization page says the organization needs approval | SAML single sign-on or OAuth app restrictions | Authorize the app for the organization, or ask an owner to approve it |
| Sign-in fails with a network or certificate error | Proxy or firewall in the way | Check the `http.proxy` setting and ask IT to allow the GitHub and Copilot domains |
| Remote or container window cannot open the browser | The browser runs on a different machine than the VS Code server | Sign in from the local window first, or use the code-copy prompt if VS Code offers one |
Remote and web windows
Remote development (SSH, Dev Containers, WSL) and VS Code for the Web add a wrinkle. The extension may run on the remote side while the browser runs on your local machine. VS Code forwards the authentication request to the local UI, so a local sign-in generally carries over. If it does not, sign in from a local window first, then reopen the remote window. In some remote cases VS Code instead shows a one-time code to paste on GitHub. In that case, copy the code exactly and finish the step within the time limit.
A short checklist
Use this order when sign-in seems wrong:
- Is the correct account listed in the Accounts menu?
- Is the Copilot extension ticked in Manage Trusted Extensions for that account?
- Does that account have a Copilot plan, free tier, or organization seat on GitHub?
- Did you reload the window after changing accounts?
- Does the Output panel show an error for GitHub Authentication or GitHub Copilot?
Work through these before reinstalling anything. Reinstalling the extension rarely fixes an identity or entitlement problem.
Exercise
You sign in successfully and your username appears in the Accounts menu, but Copilot reports that your account has no access. Your employer says you were given a seat. Name two things to check, and explain why reinstalling the extension is unlikely to help.
Show answer
First, confirm that the account shown in the Accounts menu is the one that holds the seat. You may have signed in with a personal account instead of the work account. Sign out and sign in with the right one. Second, check that GitHub Copilot is allowed under Manage Trusted Extensions for that account, and, if your organization uses SAML single sign-on, that the Visual Studio Code OAuth app is authorized for the organization. Reinstalling the extension does not help because the problem is about identity and entitlement, which are stored on GitHub and in the VS Code authentication session, not in the extension files.
Exercise
You are on a shared lab computer. What two steps make sure the next user cannot use your Copilot access, and why is the first step alone not enough?
Show answer
Sign out of your account in the VS Code Accounts menu, and revoke the Visual Studio Code authorization under GitHub Settings, Applications (also log out of github.com in the browser). Signing out of VS Code only removes the local session. The OAuth authorization on GitHub remains, and the browser may still be logged in, so a later sign-in could be approved without a password.