How to Set Up GitHub Copilot in VS Code
GitHub Copilot transforms VS Code into an AI-powered development environment that suggests code completions, functions, and entire code blocks as you type. This setup takes minutes and requires an active GitHub Copilot subscription.
- Install the GitHub Copilot extension. Open VS Code and press Ctrl+Shift+X (Cmd+Shift+X on Mac) to open Extensions. Search for 'GitHub Copilot' and click Install on the extension published by GitHub. VS Code will download and install the extension automatically.
- Sign in to GitHub. Click the Accounts icon in the Activity Bar (bottom left) and select 'Sign in with GitHub to use GitHub Copilot'. VS Code will open your default browser. Log in to your GitHub account and authorize VS Code to access GitHub Copilot.
- Verify your Copilot subscription. After authentication, VS Code will check your GitHub Copilot subscription status. If you don't have an active subscription, you'll see a prompt to start a free trial or purchase access. Complete the subscription process if needed.
- Configure Copilot settings. Press Ctrl+, (Cmd+, on Mac) to open Settings. Search for 'copilot' to view all GitHub Copilot settings. Enable or disable suggestions for different programming languages and adjust the suggestion behavior to match your preferences.
- Test Copilot suggestions. Create a new file with a programming language extension (like .js, .py, or .java). Start typing a function name or comment describing what you want to code. Copilot will display gray suggestion text that you can accept by pressing Tab or reject by continuing to type.
- Learn Copilot keyboard shortcuts. Master the essential shortcuts: Tab accepts suggestions, Escape dismisses them, Alt+] and Alt+[ cycle through alternative suggestions. Press Ctrl+Enter (Cmd+Enter on Mac) to open the Copilot suggestion panel with multiple options displayed side by side.