Tutorials

How to Set Up GitHub Copilot from Scratch

A complete setup guide for GitHub Copilot: subscription, VS Code extension, copilot-instructions.md for custom rules, and the workflow that makes Copilot follow your project conventions.

7 min read·July 5, 2025

Copilot + copilot-instructions.md: inline suggestions, chat, and edits that all follow your project conventions.

Subscription setup, copilot-instructions.md, inline and chat features, enterprise policies, and multi-tool sync

Step 1: Subscription and Installation (3 Minutes)

GitHub Copilot requires a subscription: Copilot Individual ($10/month), Copilot Business ($19/user/month — includes admin controls and policy management), or Copilot Enterprise ($39/user/month — adds knowledge bases and fine-tuning). For teams: Copilot Business is the minimum for organizational control over settings and policies. Students and open source maintainers: free access through GitHub Education.

VS Code installation: open VS Code Extensions (Cmd+Shift+X or Ctrl+Shift+X). Search 'GitHub Copilot.' Install the GitHub Copilot extension AND the GitHub Copilot Chat extension (two separate extensions). Sign in with your GitHub account when prompted. Verify: the Copilot icon appears in the status bar. For JetBrains IDEs: install the GitHub Copilot plugin from the JetBrains marketplace.

Verify it works: open any code file. Start typing a function. Copilot should suggest a completion in gray text. Press Tab to accept. If no suggestions appear: check that you are signed in (click the Copilot icon in the status bar), that Copilot is enabled for the file's language, and that the file is in a repository (Copilot works best with repository context). AI rule: 'Test Copilot with a simple function before configuring rules. If basic completions do not work: fix the authentication or extension issue first.'

Step 2: Create copilot-instructions.md (5 Minutes)

GitHub Copilot reads project-specific instructions from .github/copilot-instructions.md. Create the .github/ directory in your project root (if it does not exist). Create copilot-instructions.md inside it. This file: tells Copilot about your project conventions, tech stack, and coding patterns. Copilot reads it automatically for all chat interactions and code suggestions in this repository.

Content format: same as CLAUDE.md and .cursorrules — project context, coding conventions, testing standards, and project-specific rules. Copilot-specific considerations: keep instructions concise (Copilot's instruction context is more limited than Claude Code's CLAUDE.md context), prioritize the most impactful rules (top 15-20), and use clear, direct language (Copilot responds well to imperative statements: 'Use async/await' rather than 'We prefer async/await').

Verify: open Copilot Chat (Ctrl+Shift+I or the chat icon). Prompt: 'What coding conventions should I follow in this project?' Copilot should reference your copilot-instructions.md content. If it does not: verify the file path is exactly .github/copilot-instructions.md (case-sensitive), the file is committed to the repository (Copilot may not read uncommitted files), and Copilot Chat is using the correct workspace context.

💡 Keep copilot-instructions.md Concise — Top 15-20 Rules

Copilot's instruction context is more limited than Claude Code's CLAUDE.md context. A 100-rule instructions file: Copilot may not process all rules effectively. A 15-20 rule file: Copilot applies each rule consistently. Prioritize: security rules (non-negotiable), error handling patterns (most impactful), naming conventions (most visible), and the primary framework patterns (most frequent). If you need more detail: link to a wiki page in the instructions rather than embedding everything.

Step 3: Key Copilot Features for Convention-Aware Coding

Inline suggestions (Tab completion): Copilot suggests code as you type. Suggestions follow your copilot-instructions.md and adapt to the patterns in your current file and recently opened files. Accept with Tab. Cycle through alternatives with Alt+] (next) and Alt+[ (previous). AI rule: 'Copilot's inline suggestions are most effective when: the file has existing code that demonstrates the pattern (Copilot learns from context), and the instructions file specifies the conventions (Copilot follows the instructions).'

Copilot Chat (Ctrl+Shift+I): conversational AI for longer code generation, explanations, and refactoring. Reference files with #file: or use @workspace to include project context. Copilot Chat: reads your copilot-instructions.md automatically. Prompt: '#file:user-service.ts Create an order service following the same pattern.' AI rule: 'Use Copilot Chat for: generating new files, explaining complex code, refactoring large sections, and writing tests. Use inline suggestions for: completing lines, adding imports, and small additions.'

Copilot Edits: select code in the editor, open Copilot Chat, and describe the change. Copilot generates inline diffs showing the proposed changes. Accept or reject each change. This is Copilot's equivalent of Cursor's Cmd+K — in-place editing guided by your instructions. AI rule: 'Copilot Edits + copilot-instructions.md: the refactored code follows your current conventions, not generic best practices. The instructions guide the direction of the refactoring.'

⚠️ Configure Content Exclusions Before Team Rollout

Copilot Business/Enterprise: configure content exclusions BEFORE developers start using Copilot. Exclude: .env files (API keys, database passwords), credentials/ directories, any file containing secrets or tokens. Without exclusions: Copilot may suggest completions based on patterns it saw in secret files, potentially leaking sensitive values into code suggestions. Content exclusions: the first configuration step for any enterprise Copilot deployment.

Step 4: Enterprise and Team Configuration

Copilot Business/Enterprise: organization admins configure policies at github.com → Organization → Settings → Copilot. Policies: allow/block Copilot for specific repos, enable/disable suggestions matching public code, configure content exclusions (prevent Copilot from accessing sensitive files), and manage seat assignments. AI rule: 'For enterprise: configure content exclusions for sensitive files (.env, secrets, credentials) before rolling out to the team. Copilot should never suggest completions based on secrets files.'

Knowledge bases (Enterprise only): Copilot Enterprise allows creating knowledge bases from your organization's documentation, internal APIs, and coding standards. The knowledge base: supplements copilot-instructions.md with deeper context. Teams can ask Copilot questions about internal systems and get answers grounded in the organization's documentation. AI rule: 'If your organization uses Copilot Enterprise: the knowledge base is the most powerful customization feature. Upload: architecture docs, API specs, and internal coding standards. Copilot answers reference your organization's knowledge, not just public information.'

Multi-tool strategy: if your team uses multiple AI tools (Copilot for inline suggestions + Claude Code for CLI operations): maintain consistent rules across: .github/copilot-instructions.md (Copilot), CLAUDE.md (Claude Code), and .cursorrules (Cursor, if used). The content should be identical or nearly identical. Maintain one source file and distribute to all locations. AI rule: 'One source of truth for rules. Divergent rules across tools: creates inconsistent AI behavior depending on which tool the developer happens to use.'

ℹ️ One Source File for All AI Tools

Your team uses Copilot for inline suggestions and Claude Code for CLI operations. Two rule files to maintain: .github/copilot-instructions.md and CLAUDE.md. If they diverge: Copilot suggests one pattern, Claude Code generates another. The developer: confused. Fix: one source file (RULES.md or rules.txt). A simple script copies it to both locations. Update one file, run the script, both tools get the same rules. Zero drift. Zero confusion.

Copilot Setup Summary

Complete GitHub Copilot setup checklist.

  • Subscription: Individual ($10/mo), Business ($19/user/mo), Enterprise ($39/user/mo). Business minimum for teams
  • Install: VS Code extensions (Copilot + Copilot Chat). Sign in with GitHub account
  • Instructions: .github/copilot-instructions.md in project root. Concise, top 15-20 rules, imperative language
  • Verify: Copilot Chat prompt 'What conventions?' should reference your instructions file
  • Inline: Tab completion for small additions. Alt+]/Alt+[ to cycle alternatives
  • Chat: Ctrl+Shift+I for generation, explanation, refactoring. #file: for file references
  • Edits: select code + Chat for inline diffs. Accept/reject per change
  • Enterprise: content exclusions for secrets, knowledge bases for internal docs, policy management