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.
Table of Contents
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
// 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:
| Language | Suggestion Quality | Notes |
|---|---|---|
| Python | Excellent | Best-in-class; large training corpus |
| JavaScript / TypeScript | Excellent | Frontend, Node, frameworks all supported |
| Go | Excellent | Strong idiom awareness |
| Java | Very Good | Spring, Maven patterns recognized |
| C / C++ | Very Good | Good for algorithms and STL usage |
| Rust | Very Good | Improving rapidly |
| Ruby / PHP / Shell | Good | Common patterns covered |
| Kotlin / Swift | Good | Mobile 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
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:
| Plan | Cost | Who it’s for |
|---|---|---|
| Copilot Free | $0 | All users — 2,000 completions + 50 chat messages/month |
| Copilot Pro | $10/month | Unlimited completions, priority access, multiple models |
| Copilot Business | $19/user/month | Teams — org-level controls, audit logs |
| Copilot Enterprise | $39/user/month | Large orgs — repo-aware context, custom models |
| Students / OSS | Free | Verified students and popular OSS maintainers |
Start with Copilot Free
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:
- Go to marketplace.visualstudio.com and search for “GitHub Copilot”.
- Click the green Install button on the extension page.
- Your browser will show a prompt to open VS Code — click “Open Visual Studio Code”.
- VS Code opens with an install dialog. Click Install to confirm.
- 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:
- Open VS Code and press
Ctrl+Shift+X(Windows/Linux) orCmd+Shift+X(macOS) to open the Extensions panel. - In the search box, type
GitHub Copilot. - Find the extension published by GitHub (not a third-party fork). The publisher name appears below the extension title.
- Click the blue Install button. VS Code installs both GitHub Copilot and GitHub Copilot Chat.
Install from the official publisher only
Verifying installation success
After installation, look for these confirmation signals:
Installation verified — what to look for
– 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:
- Click the Copilot icon in the bottom-right status bar, or open the Command Palette (
Ctrl+Shift+P/Cmd+Shift+P) and runGitHub Copilot: Sign In. - A notification pops up: “Sign in to GitHub to use GitHub Copilot”. Click Sign in to GitHub.
- VS Code opens a browser window pointing to
github.com/login/oauth/authorize. - Log in to GitHub if prompted (enter your username, password, and 2FA code).
- 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
– 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
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
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:
// 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
// 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": trueConfiguring inline suggestion behavior
Copilot delivers suggestions as inline ghost text. Use these keybindings to navigate multi-suggestion mode:
| Action | Windows / Linux | macOS |
|---|---|---|
| Accept suggestion | Tab | Tab |
| Dismiss suggestion | Esc | Esc |
| Accept next word only | Ctrl+→ | Cmd+→ |
| Next suggestion | Alt+] | Option+] |
| Previous suggestion | Alt+[ | Option+[ |
| Open all suggestions panel | Ctrl+Enter | Ctrl+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:
"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
.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
// validate inputCopilot may return any validation approach with unknown assumptions.
✅ Specific:
// Validate email address: must match RFC 5322, return boolean, handle null inputCopilot 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+Enterto 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
Escto 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.
/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 commandsUse @workspace in chat
@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
editor.tabCompletion: "on"
github.copilot.inlineSuggest.enable: true
editor.suggest.preview: true
Performance and suggestion tuning
On slower machines or large projects, you may want to reduce suggestion frequency:
// 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:
// Opt out of sending suggestion feedback to GitHub
"github.copilot.telemetry.enabled": false,
// Disable snippet inclusion in telemetry
"telemetry.enableTelemetry": falseCopilot Business / Enterprise — extra privacy controls
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
- 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.).
- Verify Copilot is not disabled for the current language: open
settings.jsonand checkgithub.copilot.enable. Make sure your file’s language ID is set totrueor is not listed in the exceptions. - Check
editor.inlineSuggest.enabledistruein settings. - Test in a new, clean file (e.g., create a blank
test.pyand type a comment). This isolates whether the issue is workspace-specific. - Check your internet connection — Copilot requires outbound access to
copilot-proxy.githubusercontent.comon port 443. Corporate firewalls or VPNs sometimes block this. - Reload VS Code window:
Ctrl+Shift+P→Developer: Reload Window.
Login or authentication problems
Authentication fix checklist
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
Use the Copilot Logs for diagnostics
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.
# 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
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
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:
- Create a GitHub account and set up 2FA. Choose a Copilot plan (Free tier is a good start).
- Install VS Code 1.82 or later and keep it updated.
- Search for GitHub Copilot in the Extensions panel and install it (Copilot Chat installs automatically).
- Sign in via the status bar icon or Command Palette. Authorize in your browser.
- Configure
settings.json: set language enable/disable preferences, disable for.envfiles, and tune suggestion behavior to your workflow. - Start with a comment-driven approach. Use
Ctrl+Enterto 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.



