Back

How to Set Up GitHub Copilot in VS Code

How to Set Up GitHub Copilot in VS Code

GitHub Copilot is an AI-powered coding assistant that suggests code completions as you type, helping you write code faster with fewer errors. If you’re a web developer using VS Code, setting up Copilot takes just a few minutes and can significantly boost your productivity. This guide walks you through the installation process, plan options, and essential configuration to get you coding with AI assistance right away.

Key Takeaways

  • GitHub Copilot offers both free and paid plans with varying features and limits
  • Installation requires only the VS Code extension and GitHub authentication
  • Privacy settings and workspace-specific configurations give you control over when and how Copilot operates
  • Advanced features like inline chat and agent mode extend beyond basic code completion

What is GitHub Copilot and Why Use It?

GitHub Copilot is an AI pair programmer developed by GitHub and OpenAI that provides intelligent code suggestions directly in your editor. It analyzes your code context and suggests entire lines or blocks of code, learning from billions of lines of public code to offer relevant completions.

Developers use Copilot because it:

  • Reduces time spent on boilerplate code and repetitive patterns
  • Helps discover new APIs and coding approaches
  • Accelerates learning new languages and frameworks
  • Minimizes context switching by keeping you in your flow

GitHub Copilot Free vs Paid Plans

Before installing, understand your options:

Copilot Free Plan:

  • Monthly limit of 2,000 completions and 50 chat messages
  • Access to GPT-4o model
  • Basic code suggestions and chat features
  • Ideal for trying Copilot or occasional use

Copilot Individual ($10/month):

  • Unlimited completions and chat
  • Multiple AI models (GPT-4o, Claude 3.5 Sonnet, o1-preview, o1-mini)
  • Advanced features including multi-file editing
  • 30-day free trial available

Copilot Business/Enterprise ($19-39/user/month):

  • Everything in Individual
  • Enterprise security and compliance
  • Admin controls and usage analytics
  • Team collaboration features

Installing GitHub Copilot in VS Code

Step 1: Install the Extension

  1. Open VS Code
  2. Press Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (Mac) to open Extensions
  3. Search for “GitHub Copilot”
  4. Click Install on the official GitHub Copilot extension

Step 2: Sign In to GitHub

After installation, you’ll see the Copilot icon in your status bar (bottom right).

  1. Click the Copilot icon
  2. Select “Sign in to GitHub”
  3. Follow the browser prompts to authenticate
  4. Return to VS Code after authorization

If you don’t have a Copilot subscription, you’ll be prompted to start a free trial or select the free tier.

Step 3: Verify Setup

To confirm Copilot is working:

  1. Create a new file with a .js, .py, or .html extension
  2. Start typing a function or HTML structure
  3. Look for gray “ghost text” suggestions
  4. Press Tab to accept suggestions

Essential Configuration Settings

Managing Telemetry and Privacy

By default, Copilot may collect telemetry data. To manage privacy settings:

  1. Open VS Code Settings (Ctrl+, or Cmd+,)
  2. Search for “telemetry”
  3. Set telemetry.telemetryLevel to “off” for general VS Code telemetry

For Copilot-specific settings:

  1. Search for “github.copilot”
  2. Find “GitHub > Copilot: Enable”
  3. Uncheck to disable Copilot globally, or configure per-language settings

Workspace-Specific Settings

To disable Copilot for sensitive projects:

  1. Open Extensions view (Ctrl+Shift+X)
  2. Find GitHub Copilot
  3. Click the gear icon
  4. Select “Disable (Workspace)”
  5. Reload VS Code when prompted

Customizing Suggestion Behavior

In Settings, search for “github.copilot” to adjust:

  • Inline Suggest: Enable/disable automatic suggestions
  • Editor > Enable Auto Completions: Control when suggestions appear
  • Enable: Configure Copilot for specific languages only

Using GitHub Copilot Effectively

Basic Code Completions

As you type, Copilot suggests code in gray text. Key shortcuts:

  • Tab: Accept suggestion
  • Esc: Dismiss suggestion
  • Alt+] or Option+]: Next suggestion
  • Alt+[ or Option+[: Previous suggestion
  • Ctrl+Enter: Open Copilot panel with multiple suggestions

Advanced Features

Inline Chat (Ctrl+I or Cmd+I):

  • Select code and press the shortcut
  • Ask Copilot to refactor, explain, or improve the selection
  • Perfect for quick edits without leaving your code

Chat Panel:

  • Open Chat view from the Activity Bar
  • Use @workspace to reference your entire project
  • Ask questions about your codebase or request new implementations
  • Available models vary by subscription tier

Smart Actions:

  • Generate commit messages in Source Control view
  • Create unit tests from existing code
  • Add documentation to functions
  • Fix errors with contextual suggestions

Switching GitHub Accounts

If your Copilot subscription is on a different GitHub account:

  1. Click Accounts icon in the Activity Bar (or profile icon in bottom left)
  2. Sign out of current GitHub account
  3. Click the Copilot icon in status bar
  4. Select “Sign in to GitHub”
  5. Authenticate with the correct account

Common Troubleshooting

Copilot not suggesting code:

  • Check file extension is supported
  • Verify you’re signed in (check status bar)
  • Ensure Copilot isn’t disabled for workspace
  • Check your subscription status and limits
  • Try reloading VS Code window (Ctrl+R or Cmd+R)

Poor suggestion quality:

  • Provide more context in your file
  • Write descriptive comments before functions
  • Use clear variable and function names
  • Include relevant imports and type definitions

Network issues:

  • Check firewall settings allow connections to github.com
  • Verify proxy configuration if behind corporate network
  • Test with github.copilot.advanced.debug.testConnection command in Command Palette

Conclusion

Setting up GitHub Copilot in VS Code transforms your coding experience with AI-powered suggestions that adapt to your style. Whether you’re using the free plan to explore its capabilities or leveraging paid features for professional development, the setup process remains straightforward. Start with basic completions, experiment with inline chat for quick improvements, and explore the chat panel for building entire features. With proper configuration and privacy settings in place, you’re ready to code faster and more efficiently with your AI pair programmer.

FAQs

GitHub Copilot requires an active internet connection to work. It sends your code context to GitHub's servers where the AI models process it and return suggestions. Without internet access, Copilot cannot generate any code completions or chat responses.

GitHub Copilot does not store or train on your private code by default. For individual and free users, your code is transmitted for processing but not retained. Business and Enterprise customers have additional guarantees that their code won't be used for training models.

You can exclude specific files or patterns by creating a .copilotignore file in your repository root. It works like .gitignore, supporting wildcards and path patterns. Alternatively, disable Copilot for specific file types in VS Code settings under github.copilot.enable.

Inline completions appear automatically as ghost text while you type, offering immediate suggestions. The chat feature requires manual activation and allows conversational interactions for explaining code, generating tests, or creating entire features with more complex context and requirements.

Understand every bug

Uncover frustrations, understand bugs and fix slowdowns like never before with OpenReplay — the open-source session replay tool for developers. Self-host it in minutes, and have complete control over your customer data. Check our GitHub repo and join the thousands of developers in our community.

OpenReplay