Set up GitHub Copilot in VS Code

Set up GitHub Copilot in VS Code

This guide walks you through setting up GitHub Copilot in Visual Studio Code. To use Copilot in VS Code, you need access to GitHub Copilot with your GitHub account.

This article covers the GitHub Copilot setup path. To use Claude, Codex, or your own model credentials for supported agent workflows, compare the agent harness authentication and billing options. Some agent workflows without GitHub sign-in are experimental.

Before you start

Review these account, usage, and data-handling details before you send project content to an AI model:

  • Account access: the recommended setup uses a GitHub account with a Copilot plan. If your employer provides Copilot, use the account and policies for your organization. Without a plan, signing in enrolls an eligible account in Copilot Free.
  • Usage and billing: models included with Copilot consume AI credits from your Copilot plan. If you use Anthropic credentials, a ChatGPT subscription, or your own API key, that provider manages usage and billing instead. Compare the authentication and billing options for each agent harness.
  • Monitor usage: open the Copilot status dashboard from the VS Code Status Bar to view the percentage of your monthly allowance that you used. Learn how to monitor usage and what happens when you reach a limit.
  • Data handling: review the GitHub Copilot Trust Center and your organization's policies before you send work code. Models that use third-party credentials or your own API key follow that provider's terms. VS Code telemetry settings are separate from AI-provider data handling.

To use chat with your own model instead, bring your own language model key. This path doesn't require a Copilot plan, but some features, including inline suggestions, semantic search, and embeddings, still require the GitHub Copilot service.

Set up GitHub Copilot

Follow these steps to get started with Copilot in VS Code:

  1. Hover over the Copilot icon in the Status Bar and select Use AI Features.

  2. Choose a sign-in method and follow the prompts.

    • If you already have a Copilot subscription for your account, VS Code will use that subscription.

    • If you don't have a Copilot subscription yet, you'll be signed up for the Copilot Free plan and get a monthly allowance of inline suggestions and AI credits. Learn more about the different GitHub Copilot plans.

  3. Start using Copilot in VS Code!

    Learn the basics with the agents quickstart.

Important

Telemetry in your free version of GitHub Copilot is currently enabled. By default, code suggestions that match public code, including code references in the VS Code and github.com experience, are allowed. You can opt out of telemetry data collection by disabling telemetry in VS Code by setting telemetry.telemetryLevel Open in VS Code Open in VS Code Insiders to off, or you can adjust both telemetry and code suggestion settings in Copilot Settings.

Prepare a project for AI (optional)

After you sign in, enter /init in a chat session to create starter custom instructions for a project. The command analyzes the codebase and records coding practices that help AI-generated code match the project.

Use Copilot with a GHE account

If your Copilot subscription is associated with a GitHub Enterprise (GHE) account, you can sign in to Copilot in VS Code with your GHE credentials.

  1. If you haven't already, hover over the Copilot icon in the Status Bar and select Use AI Features.

  2. In the sign in dialog, choose Continue with GHE.com and provide your GHE instance URL and credentials.

If you need to switch between a GitHub.com account and a GHE account, see Use a different GitHub account per workspace or profile for instructions.

Use a different GitHub account with Copilot

If your Copilot subscription is associated with another GitHub account, follow these steps to sign out of your GitHub account in VS Code, and sign in with another account.

  1. Select the Accounts menu in the Activity Bar, and then select Sign out for the account you're currently signed in with.

    Accounts menu in VS Code, showing the option to sign out of the current GitHub account.

  2. Sign in to your GitHub account using any of the following methods:

    • Select Sign in to use Copilot from the Copilot menu in the Status Bar.

      Sign in to use Copilot from the Copilot status menu.

    • Select the Accounts menu in the Activity Bar, and then select Sign in with GitHub to use GitHub Copilot.

      Accounts menu in VS Code, showing the option to sign in with GitHub to use GitHub Copilot.

    • Run the GitHub Copilot: Sign in command in the Command Palette (⇧⌘P (Windows, Linux Ctrl+Shift+P)).

Use a different GitHub account per workspace or profile

You can use different GitHub accounts for Copilot per VS Code workspace or profile. This is useful if you use Copilot with different accounts for work and personal projects, or if you want to use different accounts for different extensions that use GitHub authentication.

Follow these steps to configure which GitHub account to use for Copilot. This configuration is saved per workspace and per profile.

  • For GitHub.com accounts:

    1. In the Accounts menu in the Activity Bar, select Manage Extension Account Preferences
    2. Select GitHub Copilot Chat from the list of extensions
    3. Choose the GitHub account you want to use for Copilot in the current workspace and profile
  • For GHE.com accounts:

    Tip

    If you only want to use a GHE account for Copilot, follow the steps in Use Copilot with a GHE account to sign in with your GHE account.

    1. Run Preferences: Open User Settings (JSON) or Preferences: Open Workspace Settings (JSON) from the Command Palette (⇧⌘P (Windows, Linux Ctrl+Shift+P))

    2. Add the following setting to specify GitHub Enterprise as the authentication provider for Copilot:

      "github.copilot.advanced": {
          "authProvider": "github-enterprise"
      }
      
    3. Re-sign in to your GitHub Enterprise account if you're not already signed in

Remove AI features from VS Code

You can disable the built-in AI features in VS Code with the chat.disableAIFeatures Open in VS Code Open in VS Code Insiders setting, similar to how you configure other features in VS Code. This disables and hides features like chat or inline suggestions in VS Code and disables the Copilot extensions. You can configure the setting at the workspace or user level.

Alternatively, use the Learn How to Hide AI Features action from the Chat menu in the title bar to access the setting.

Note

If you have previously disabled the built-in AI features, your choice is respected upon updating to a new version of VS Code.

Disable AI features for a workspace

To disable AI features for a specific workspace, configure the chat.disableAIFeatures Open in VS Code Open in VS Code Insiders setting in workspace settings. This setting is available in the Settings editor (⌘, (Windows, Linux Ctrl+,)), or you can edit the settings.json file in the workspace.

Next steps