Sub topic 4
Sign in with your GitHub account
This chapter assumes you have installed the GitHub Copilot extension in VS Code and have a GitHub account. That account needs Copilot access through a plan (Free, Pro, or one provided by an organization). Signing in connects the editor to that account. Without it, the extension is installed but does nothing.
What signing in does
VS Code uses an authentication provider to sign in to GitHub. When you sign in, GitHub issues a token to VS Code for the Copilot extension. The extension uses this token to check your Copilot entitlement before it returns suggestions or chat answers.
The token belongs to the VS Code installation, not to a single window. Once you sign in, every window uses the same session until you sign out or the session expires.
Sign in step by step
- Open VS Code. If you installed the extension recently, a sign-in prompt may already be visible in the Chat view or the status bar.
- Select Sign in with GitHub. You can also open the Accounts menu (the person icon at the bottom of the Activity Bar) and choose to sign in with GitHub to use Copilot.
- VS Code opens your default browser at a GitHub authorization page. Sign in to GitHub there if you are not already.
- Review the permissions requested for Visual Studio Code and select Authorize.
- The browser asks to open VS Code. Allow it. The editor receives the authorization and finishes the sign-in.
- Check the Accounts menu. It should list your GitHub username.
Confirm that it worked
After sign-in, look at the Copilot icon in the status bar. A normal icon means Copilot is ready. An icon with a slash or warning means something is still wrong, and hovering over it shows a message. You can also open the Chat view. If it shows a chat input instead of a sign-in prompt, your account has access.
The next chapter uses inline suggestions to test this. If suggestions appear as you type, you are signed in and entitled to use Copilot.
Common sign-in problems
The sign-in flow has several places where it can break. These are the ones you will see most often.
| Symptom | Likely cause | What to try |
|---|---|---|
| Browser opens but VS Code never receives the result | The browser blocked the "open VS Code" prompt, or a different VS Code build (such as Insiders) is registered as the handler | Allow the prompt in the browser, then retry. Make sure the build you started the flow from is the one you expect. |
| Signed in, but Copilot says you have no access | The GitHub account you used has no Copilot plan | Check your plan on GitHub, or sign in with the account that has one. |
| Signed in as the wrong account | The browser was already logged in to another GitHub account | Sign out from the Accounts menu, switch accounts in the browser, and sign in again. |
| Authorization fails for an organization account | The organization requires SAML single sign-on or restricts third-party apps | Authorize the session for the organization, or ask an administrator. |
| Sign-in loops or hangs | An old or corrupted session | Sign out from the Accounts menu, reload the window, and sign in again. |
Signing out
Use the Accounts menu to sign out. This ends the session for VS Code, so Copilot stops responding in every window until you sign in again. Do this on shared or borrowed computers when you finish.
Exercise
You finish the browser authorization, but Copilot shows a message saying your account does not have access. You are sure the extension is installed. What are two things you should check?
Show answer
First, check which GitHub account VS Code is signed in with (the Accounts menu), because the browser may have used a different account than the one with a Copilot plan. Second, check that the account has a Copilot plan or organization seat on GitHub. If the account is part of an organization with SAML single sign-on, also confirm that the session is authorized for that organization.
Exercise
Why does a remote window (such as WSL or SSH) still open a browser on your local machine during sign-in?
Show answer
The browser flow is part of VS Code's authentication, which runs on your local machine. The Copilot extension itself runs in the remote environment, so it must be installed there too, but the authorization page opens locally.