How to Install and Configure GitHub Copilot in VS Code Like a Pro

|

Learn how to install and configure GitHub Copilot in VS Code step by step. Set up Copilot like a pro, enable AI code suggestions, and improve your coding productivity in minutes with this beginner-friendly guide.

Copilot
Read Time 9 min

What is GitHub Copilot and Why Use It in VS Code

GitHub Copilot is an AI-powered code completion and generation tool built by GitHub and OpenAI. It integrates directly into your editor as an extension and provides real-time suggestions as you type — from single lines to complete functions, tests, and documentation.

How GitHub Copilot works

Copilot is powered by OpenAI Codex (and its successors), a large language model trained on billions of lines of public code. When you write code or comments, Copilot sends your current file context — including the surrounding code and language — to GitHub’s servers. The model processes that context and returns completions, which appear as ghost text inline in your editor.

Context → Model → Suggestion → You accept or reject

You type a comment: // Function to validate email address. Copilot reads your file language (JavaScript), imports, and the comment. It returns a full function body as ghost text. You press Tab to accept, or keep typing to dismiss.

Benefits of using Copilot for developers

  • Faster boilerplate — Stop rewriting repetitive patterns. Copilot handles CRUD operations, form validation, API calls, and more.
  • Contextual documentation — Type a function name and Copilot suggests JSDoc or Python docstrings automatically.
  • Learning accelerator — Exploring a new library? Copilot suggests usage patterns as you type, surfacing documentation in-context.
  • Test generation — Describe what you want to test and Copilot scaffolds the test cases.
  • Reduced context switching — Stay in your editor instead of switching to browser tabs for Stack Overflow or documentation.

Supported programming languages and IDEs

Copilot works across virtually every major language. Its strongest performance is in:

LanguageSuggestion QualityNotes
PythonExcellentBest-in-class; large training corpus
JavaScript / TypeScriptExcellentFrontend, Node, frameworks all supported
GoExcellentStrong idiom awareness
JavaVery GoodSpring, Maven patterns recognized
C / C++Very GoodGood for algorithms and STL usage
RustVery GoodImproving rapidly
Ruby / PHP / ShellGoodCommon patterns covered
Kotlin / SwiftGoodMobile idioms recognized

Beyond VS Code, Copilot also supports JetBrains IDEs (IntelliJ, PyCharm, WebStorm), Visual Studio, Vim/Neovim, and GitHub.com itself via Copilot Chat.


Prerequisites Before Installing GitHub Copilot

GitHub account requirements

You need a free GitHub account at github.com. If you don’t have one, sign up at github.com/signup — it takes under two minutes. Your GitHub account is what Copilot authenticates against, not a separate service account.

Two-factor authentication

GitHub now enforces 2FA for all accounts. Before installing Copilot, make sure your account has 2FA configured under Settings → Password and authentication. This prevents auth failures during the Copilot sign-in flow.

Visual Studio Code installation

You need VS Code 1.82 or later for full Copilot Chat support. Download the latest stable build from code.visualstudio.com. The extension works on Windows, macOS, and Linux.

To check your current version: open VS Code and go to Help → About (Windows/Linux) or Code → About Visual Studio Code (macOS). The version number appears in the first line.

Subscription and eligibility for Copilot

Copilot requires one of the following:

PlanCostWho it’s for
Copilot Free$0All users — 2,000 completions + 50 chat messages/month
Copilot Pro$10/monthUnlimited completions, priority access, multiple models
Copilot Business$19/user/monthTeams — org-level controls, audit logs
Copilot Enterprise$39/user/monthLarge orgs — repo-aware context, custom models
Students / OSSFreeVerified students and popular OSS maintainers

Start with Copilot Free

GitHub’s Free tier gives you 2,000 code completions and 50 Copilot Chat messages per month — enough to evaluate the tool properly before committing to a paid plan. No credit card required.

How to Install the GitHub Copilot Extension in VS Code

There are two methods to install Copilot. Both end up at the same result — pick whichever feels more comfortable.

Installing Copilot from VS Code Marketplace

The quickest path is directly from the VS Code Marketplace in your browser:

  1. Go to marketplace.visualstudio.com and search for “GitHub Copilot”.
  2. Click the green Install button on the extension page.
  3. Your browser will show a prompt to open VS Code — click “Open Visual Studio Code”.
  4. VS Code opens with an install dialog. Click Install to confirm.
  5. VS Code also automatically installs GitHub Copilot Chat as a companion extension.

Alternative installation via Extensions panel

If you prefer to stay inside VS Code:

  1. Open VS Code and press Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (macOS) to open the Extensions panel.
  2. In the search box, type GitHub Copilot.
  3. Find the extension published by GitHub (not a third-party fork). The publisher name appears below the extension title.
  4. Click the blue Install button. VS Code installs both GitHub Copilot and GitHub Copilot Chat.

Install from the official publisher only

Search results may include unofficial Copilot extensions with similar names. Always verify the publisher is GitHub with the verified blue checkmark. Installing unofficial extensions can pose security risks.

Verifying installation success

After installation, look for these confirmation signals:

Installation verified — what to look for

– A Copilot icon (star/sparkle shape) appears in the VS Code status bar at the bottom right.
– In the Extensions panel, both GitHub Copilot and GitHub Copilot Chat show a blue “Installed” indicator.
– A chat bubble icon appears in the left Activity Bar — this is Copilot Chat.
– VS Code may show a notification: “Sign in to GitHub to use GitHub Copilot”.

How to Sign In and Activate GitHub Copilot

Connecting your GitHub account in VS Code

Installation alone is not enough — you must authenticate Copilot against your GitHub account:

  1. Click the Copilot icon in the bottom-right status bar, or open the Command Palette (Ctrl+Shift+P / Cmd+Shift+P) and run GitHub Copilot: Sign In.
  2. A notification pops up: “Sign in to GitHub to use GitHub Copilot”. Click Sign in to GitHub.
  3. VS Code opens a browser window pointing to github.com/login/oauth/authorize.
  4. Log in to GitHub if prompted (enter your username, password, and 2FA code).
  5. GitHub shows an authorization page listing the permissions Copilot requires. Click Authorize GitHub Copilot.

Authorizing Copilot access

After you authorize, GitHub redirects back to VS Code automatically with a deep-link callback. VS Code shows a prompt asking you to allow the redirect — click Open. Copilot is now authenticated and active.

Successful sign-in — confirmation signals

– The status bar Copilot icon turns white (or colored) and no longer shows a warning triangle.
– Hovering over the status bar icon shows your GitHub username.
– Opening any code file and typing will produce ghost-text suggestions within a few seconds.

Troubleshooting login issues

Browser opens but VS Code doesn’t receive the callback

This usually means a firewall or security software is blocking the localhost redirect. Try disabling VPN temporarily, then repeat the sign-in flow. Alternatively, use the Device Activation flow: open the Command Palette, run GitHub Copilot: Sign In with a Device Code, then visit github.com/login/device and enter the displayed code.

Sign-in succeeds but Copilot icon still shows an error

Sign out completely: open the Command Palette, run GitHub Copilot: Sign Out, then GitHub Copilot: Sign In again. If that fails, check VS Code Accounts (bottom-left person icon) and remove any stale GitHub accounts, then re-authenticate.

How to Configure GitHub Copilot in VS Code

Copilot’s behavior is controlled through VS Code’s settings.json. Open it via File → Preferences → Settings and click the JSON icon in the top-right corner, or use the Command Palette: Preferences: Open User Settings (JSON).

Enabling or disabling Copilot

You can toggle Copilot globally or on a per-language basis. The global toggle is the quickest way to pause suggestions when you need to focus:

settings.json
// Enable or disable Copilot globally
"github.copilot.enable": {
  "*": true,       // enable for all languages
  "plaintext": false, // disable for plain text files
  "markdown": false,  // disable in Markdown
  "yaml": true        // enable for YAML configs
}

You can also toggle Copilot quickly from the status bar: click the Copilot icon and select Disable Completions (globally or for the current file type).

Adjusting suggestion settings

settings.json — suggestion behavior
// Show suggestions automatically as you type
"editor.inlineSuggest.enabled": true,

// Don't suppress Copilot suggestions when other completions show
"github.copilot.inlineSuggest.enable": true,

// Show suggestions even when standard IntelliSense is open
"editor.suggest.showInlineDetails": true

Configuring inline suggestion behavior

Copilot delivers suggestions as inline ghost text. Use these keybindings to navigate multi-suggestion mode:

ActionWindows / LinuxmacOS
Accept suggestionTabTab
Dismiss suggestionEscEsc
Accept next word onlyCtrl+→Cmd+→
Next suggestionAlt+]Option+]
Previous suggestionAlt+[Option+[
Open all suggestions panelCtrl+EnterCtrl+Enter

Setting language-specific preferences

You can fine-tune Copilot behavior per language identifier. This is useful if you want suggestions everywhere except configuration files:

settings.json — per-language config
"github.copilot.enable": {
  "*": true,
  "python": true,
  "javascript": true,
  "typescript": true,
  "json": false,   // off in JSON (sensitive configs)
  "env": false,    // NEVER suggest in .env files
  "dotenv": false  // keep secrets out of context
}

Disable Copilot in secret files

Always disable Copilot for .env, *.pem, *.key, and other files containing credentials. Even though Copilot doesn’t deliberately leak secrets, having Copilot active in those files sends their contents as context to GitHub’s servers.

How to Use GitHub Copilot Effectively After Setup

Writing better code prompts in comments

Copilot reads your comments as instructions. The quality of suggestions directly correlates with how descriptive your comments are. Treat them like prompts to a code-writing assistant — be explicit about inputs, outputs, edge cases, and desired patterns.

Prompt quality comparison: Vague vs. specific comments

❌ Vague: // validate input
Copilot may return any validation approach with unknown assumptions.
✅ Specific: // Validate email address: must match RFC 5322, return boolean, handle null input
Copilot returns a targeted, correct implementation with null-safety.

Accepting and rejecting suggestions

Build a rhythm of quickly accepting what works and ignoring what doesn’t. Key habits:

  • Use Ctrl+Enter to open the Copilot suggestions panel and see up to 10 alternatives for the current cursor position.
  • Accept only the next word with Ctrl+→ (macOS: Cmd+→) when a suggestion is partially correct — you don’t have to accept the full line.
  • Press Esc to dismiss without penalty. Copilot continues suggesting on next keystroke.
  • Don’t stop typing to wait for suggestions — keep typing and let Copilot adapt.

Using Copilot Chat in VS Code

Copilot Chat is a separate but related feature that gives you a conversational interface to Copilot. It’s installed alongside the main extension and lives in the Activity Bar on the left.

Copilot Chat slash commands
/explain    Explain the selected code block in plain English
/fix        Suggest a fix for the selected code
/tests      Generate unit tests for the selected function
/doc        Generate documentation for the selection
/simplify   Refactor and simplify selected code
/new        Scaffold a new project or file
/terminal   Explain or suggest terminal commands

Use @workspace in chat

In Copilot Chat, prefix your question with @workspace to give Copilot context about your entire project structure. For example: @workspace Where is the database connection configured? This is dramatically more useful than asking without context.

Best GitHub Copilot Settings for Developers

Recommended settings for beginners

If you’re new to Copilot, start with a conservative setup that makes suggestions visible without overwhelming your normal typing flow:

editor.inlineSuggest.enabled: true

Shows ghost-text suggestions inline as you type. This is the core Copilot experience.

editor.tabCompletion: "on"

Ensures Tab key accepts inline suggestions before triggering other completions.

github.copilot.inlineSuggest.enable: true

Enables the Copilot inline suggestion engine. Master switch for all ghost-text.

editor.suggest.preview: true

Shows a preview of selected suggestions in the editor before acceptance.

Performance and suggestion tuning

On slower machines or large projects, you may want to reduce suggestion frequency:

settings.json — performance tuning
// Only trigger suggestions after a pause in typing
"editor.quickSuggestionsDelay": 300,

// Reduce IntelliSense noise so Copilot stands out
"editor.quickSuggestions": {
  "strings": false,
  "comments": false,
  "other": true
},

// Disable word-based IntelliSense to reduce clutter
"editor.wordBasedSuggestions": "off"

Privacy and data settings

GitHub collects telemetry about Copilot suggestions by default. If you want to opt out:

settings.json — privacy
// Opt out of sending suggestion feedback to GitHub
"github.copilot.telemetry.enabled": false,

// Disable snippet inclusion in telemetry
"telemetry.enableTelemetry": false

Copilot Business / Enterprise — extra privacy controls

On paid organizational plans, administrators can disable Prompt Transmission so code context is never sent to GitHub’s servers. This is configured at the organization level in GitHub’s settings, not in VS Code. Check with your admin if you’re on a company plan.

Common Issues and How to Fix GitHub Copilot in VS Code

Copilot not showing suggestions

Copilot is installed and signed in — but no ghost text appears

Work through this checklist in order:
  1. Check the status bar Copilot icon. If it shows a warning triangle, hover over it — the tooltip will tell you the exact reason (not subscribed, network issue, disabled for language, etc.).
  2. Verify Copilot is not disabled for the current language: open settings.json and check github.copilot.enable. Make sure your file’s language ID is set to true or is not listed in the exceptions.
  3. Check editor.inlineSuggest.enabled is true in settings.
  4. Test in a new, clean file (e.g., create a blank test.py and type a comment). This isolates whether the issue is workspace-specific.
  5. Check your internet connection — Copilot requires outbound access to copilot-proxy.githubusercontent.com on port 443. Corporate firewalls or VPNs sometimes block this.
  6. Reload VS Code window: Ctrl+Shift+PDeveloper: Reload Window.

Login or authentication problems

Authentication fix checklist

– Sign out, then sign back in: Command Palette → GitHub Copilot: Sign Out → GitHub Copilot: Sign In.
– Remove stale tokens: Go to github.com/settings/applications and revoke the GitHub Copilot Plugin authorization. Re-authenticate in VS Code.
– Check subscription status: Visit github.com/settings/copilot to confirm your plan is active.
– Device code flow: If browser redirects fail, use Command Palette → GitHub Copilot: Sign In with a Device Code.

Extension not working or disabled

Copilot was working, then suddenly stopped

Most sudden failures are caused by a VS Code update, an extension update, or an expired authentication token. Try these in order: (1) Reload the VS Code window. (2) Sign out and back in. (3) Check for extension updates in the Extensions panel — both Copilot extensions should be on the latest version. (4) Disable conflicting extensions one-by-one (other AI completion tools like Tabnine or Kite can conflict with Copilot’s inline suggestion handler).

Use the Copilot Logs for diagnostics

Open View → Output in VS Code, then select “GitHub Copilot” from the dropdown. The log shows real-time request/response data including authentication errors and API timeouts — far more useful than guessing.

Tips to Use GitHub Copilot Like a Pro

Writing clear code comments for better AI output

The single biggest lever for improving Copilot suggestion quality is the quality of your surrounding code context. Copilot reads everything in your open file — function names, variable names, imports, and comments — to infer intent.

python — comment-driven development
# Parse a CSV file from `filepath`.
# Return a list of dicts, one per row, using the first row as headers.
# Skip rows where 'status' column equals 'inactive'.
# Raise ValueError if file doesn't exist.
def parse_active_users(filepath: str) -> list[dict]:
    # Copilot generates the full implementation here ↓

Using Copilot for learning new frameworks

One of Copilot’s most underrated uses is framework exploration. When you start a new project with an unfamiliar library, let Copilot suggest idiomatic patterns as you type. It accelerates learning by showing you how experienced developers use the tool.

Learning Prisma ORM for the first time

Instead of reading docs first, create a file named db.ts, import Prisma, and write comments describing what you want. Copilot will suggest the schema definitions, client instantiation pattern, and query syntax in context — showing you idiomatic Prisma as you build, not as an abstract tutorial.

Combining Copilot with manual coding

The most productive developers treat Copilot as a draft generator, not a final author. Effective patterns:

  • Accept, then refactor: Let Copilot generate a working first draft. Then rewrite for your naming conventions, error handling, and performance requirements.
  • Use Copilot for the tedious, manual for the critical: Let Copilot write data mapping, serialization, and API clients. Write your own business logic, security checks, and core algorithms.
  • Always review suggestions: Copilot can suggest code that compiles but has subtle bugs, outdated API calls, or insecure patterns (e.g., using eval(), missing input validation). Read every accepted suggestion.
  • Combine with tests: Write the test first (describe the expected behavior in a comment), let Copilot generate the implementation, then run your tests to verify correctness.

Never blindly accept suggestions in security-sensitive code

Copilot is trained on public code, which includes insecure patterns. Authentication flows, cryptography, input validation, and SQL query construction should always be written and reviewed manually, even if Copilot suggests something plausible-looking.

Conclusion

Summary of setup steps

Getting GitHub Copilot running in VS Code is a five-minute process once you have the prerequisites. Here’s the complete flow at a glance:

  1. Create a GitHub account and set up 2FA. Choose a Copilot plan (Free tier is a good start).
  2. Install VS Code 1.82 or later and keep it updated.
  3. Search for GitHub Copilot in the Extensions panel and install it (Copilot Chat installs automatically).
  4. Sign in via the status bar icon or Command Palette. Authorize in your browser.
  5. Configure settings.json: set language enable/disable preferences, disable for .env files, and tune suggestion behavior to your workflow.
  6. Start with a comment-driven approach. Use Ctrl+Enter to see alternative suggestions. Use Copilot Chat for explanations and test generation.

Final thoughts on boosting productivity with Copilot

GitHub Copilot delivers the most value when you think of it as a first-draft engine, not an oracle. It dramatically reduces friction on repetitive tasks — boilerplate, tests, documentation, data transformations — freeing your focus for higher-order decisions: architecture, algorithms, security, and product logic.

The developers who get the most from Copilot aren’t the ones who accept every suggestion. They’re the ones who’ve learned to write clear, specific comments, build strong context through good code structure, and review AI output with the same rigor they’d apply to a junior engineer’s pull request.

Next steps

Now that Copilot is configured, explore the deeper usage patterns and prompt engineering techniques covered in our upcoming guides below. The setup gets you started — the prompts are what make you fast.

How to Use GitHub Copilot: Full Workflow Guide

Real-world patterns for using Copilot across frontend, backend, testing, and documentation workflows. Read How to Use GitHub Copilot.

Best GitHub Copilot Prompts for Developers

Tested comment templates and prompting patterns that produce consistently accurate, production-ready code.

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x