GitHub Copilot logo
10 minute setup

How to Set Up GitHub Copilot

Install GitHub Copilot in VS Code, learn the keyboard shortcuts, and start getting AI-powered code suggestions as you type. The original AI pair programmer.

Prerequisites

  • Visual Studio Code installed (latest version recommended)
  • A GitHub account (free accounts get limited Copilot access)
  • A Copilot subscription (Individual at $10/mo, or free for verified students and OSS maintainers)
  • Internet connection (Copilot runs in the cloud)
1

Sign Up for Copilot

Go to github.com/features/copilot and activate your subscription. GitHub offers several plans:

  • Copilot Free — Limited completions and chat messages per month. Good for trying it out.
  • Copilot Pro ($10/mo) — Unlimited completions, chat, and access to multiple models. Best for individual developers.
  • Copilot Business ($19/user/mo) — Organization-level management, policy controls, and IP indemnity.

Free for students

If you have a verified GitHub Education account, Copilot Pro is free. Go to education.github.com to verify your student status.
2

Install VS Code Extension

Open VS Code and go to the Extensions panel (Ctrl+Shift+X). Search for "GitHub Copilot" and install the official extension by GitHub.

You will see two extensions:

  • GitHub Copilot — Inline code completions (the ghost text as you type). Install this first.
  • GitHub Copilot Chat — Conversational AI assistant in the sidebar. Install this too.

Both extensions are published by GitHub and have millions of installs. Make sure you install the official ones, not third-party alternatives.

You can also install from the command line: code --install-extension GitHub.copilot
3

Sign In

After installing, VS Code prompts you to sign in with GitHub. Click Sign In, authorize the extension in your browser, and return to VS Code.

You should see a Copilot icon in the bottom-right status bar. If it shows a green dot, you are connected and ready. If it shows a warning, check that your Copilot subscription is active.

If sign-in fails, make sure you are using the same GitHub account that has the Copilot subscription. Check your firewall settings if you are on a corporate network — Copilot needs to reach GitHub's API servers.
4

Get Your First Suggestion

Open any code file and start typing. Copilot shows suggestions as gray "ghost text" inline with your cursor. For example, create a new file called utils.ts and type:

// Function that validates an email address
function validateEmail(

Copilot should complete the function signature, body, and return type. The suggestion appears as dimmed text — it has not been inserted into your code yet.

Not seeing suggestions?

Make sure the Copilot icon in the status bar is active (not disabled). Also check that you are in a supported language file. Copilot works with virtually all programming languages, but the quality varies.
5

Accept/Reject Shortcuts

Master these keyboard shortcuts to work efficiently with Copilot:

  • Tab — Accept the full suggestion
  • Esc — Reject the suggestion and dismiss it
  • Alt+] — Show the next alternative suggestion
  • Alt+[ — Show the previous alternative suggestion
  • Ctrl+Right Arrow — Accept one word at a time (partial accept)

Partial accept is underrated. When Copilot gets the first part right but the rest wrong, accept word-by-word until you reach the point where you want to diverge, then keep typing manually.

Get the Vibe Coding Cheat Sheet

Best tool for every use case + pricing + pro tips. One page, zero fluff. Plus weekly updates on new tools.

6

Enable Copilot Chat

With the Copilot Chat extension installed, click the chat icon in the sidebar or press Ctrl+Shift+I to open an inline chat right in your editor.

Copilot Chat can:

  • Explain selected code in plain English
  • Generate tests for a function
  • Fix bugs you highlight
  • Suggest refactoring approaches
  • Answer questions about your project

Use slash commands for common tasks:

/explain  — Explain how the selected code works
/fix      — Suggest a fix for the selected code
/tests    — Generate unit tests
/doc      — Generate documentation comments
7

Use Inline Edits

Select a block of code and press Ctrl+I to open the inline edit prompt. Type what you want to change and Copilot rewrites the selection in place.

Examples of effective inline edit prompts:

"Add error handling for null values"
"Convert this to an async function"
"Add TypeScript types to all parameters"
"Optimize this loop for performance"
"Add JSDoc comments to this function"

Copilot shows a diff of the proposed changes. Click Accept to apply or Discard to cancel.

Inline edits are context-aware. Copilot reads the surrounding code, imports, and file structure. The more organized your code, the better the edits.
8

Configure Settings

Open VS Code Settings (Ctrl+,) and search for "Copilot" to customize behavior:

  • Enable/disable per language — Turn off suggestions for Markdown, JSON, or other non-code files if they are distracting.
  • Inline suggestions — Toggle the ghost text completions on or off.
  • Suggestion count — Control how many alternatives Copilot generates.

You can also configure Copilot in your settings.json:

{
  "github.copilot.enable": {
    "*": true,
    "markdown": false,
    "plaintext": false,
    "yaml": false
  },
  "github.copilot.editor.enableAutoCompletions": true
}

Keep it on by default

Most developers find Copilot most useful when it is always on. The suggestions are non-intrusive — they appear as ghost text and only insert when you press Tab. If a suggestion is bad, just keep typing and it disappears.

What to Build First

Unit Test Suite

Beginner10 min

Open a file with functions but no tests. Start writing "test(" and let Copilot generate the entire test suite. It reads your function signatures and generates meaningful assertions.

REST API Endpoint

Intermediate15 min

Create a new route file and type a comment: "// GET /api/users - returns paginated list of users." Copilot generates the handler, query params, error handling, and response types.

Refactor Legacy Code

Intermediate20 min

Select a messy function, press Ctrl+I, and tell Copilot: "Refactor this to use async/await, add error handling, and split into smaller functions." Review the diff and accept.

Copilot Tips from Power Users

Write comments first

Type a comment describing what the next function should do, then hit Enter. Copilot reads the comment and generates the implementation. Good comments produce great code.

Cycle through alternatives

Press Alt+] (next) and Alt+[ (previous) to cycle through different suggestions. Copilot often has 3-5 alternatives — the first one is not always the best.

Open relevant files for context

Copilot uses open tabs as context. If you want it to follow patterns from another file, open that file in a tab. It will match the style and conventions it sees.

Use Chat for explanations

Select code and press Ctrl+Shift+I to ask Copilot Chat to explain it. Great for onboarding onto new codebases or understanding unfamiliar patterns.

Slash commands in Chat

Type /fix to fix bugs in selected code, /tests to generate tests, /explain for explanations, and /doc to generate documentation. These shortcuts save time.

Disable for specific languages

If Copilot is distracting in certain file types (like Markdown or config files), disable it per language in VS Code Settings. This keeps suggestions focused on code.

Essential Keyboard Shortcuts

ActionMacWindows
Accept suggestionTabTab
Reject suggestionEscEsc
Next suggestionOption+]Alt+]
Previous suggestionOption+[Alt+[
Accept wordCmd+RightCtrl+Right
Open inline chatCmd+ICtrl+I
Open Chat panelCmd+Shift+ICtrl+Shift+I
Trigger suggestionOption+\Alt+\

You are set up. Now explore.

Compare Copilot against other tools, or submit what you build to the showcase.

We use cookies for analytics. Learn more