How to Set Up GitHub Copilot in IntelliJ IDEA (Step by Step)
GitHub Copilot works in IntelliJ IDEA and other JetBrains IDEs through an official plugin. You get inline suggestions, a chat window and agent mode.
In short: install the GitHub Copilot plugin from the Marketplace, restart, then Tools → GitHub Copilot → Login to GitHub, and paste the device code.
Why use Copilot in IntelliJ
Java and Kotlin teams at many companies live in IntelliJ. Copilot gives them AI help without leaving the IDE. The same plugin also works in PyCharm, WebStorm, GoLand, Rider, CLion, PhpStorm and Android Studio.
What you need
- A GitHub account with Copilot: Copilot Free (limited) or a paid Copilot plan.
- IntelliJ IDEA: Ultimate or Community (other JetBrains IDEs also work).
- GitHub Copilot plugin: from the JetBrains Marketplace, made by GitHub.
- A browser: to approve the device code login.
How setup flows
Install steps
- Open IntelliJ IDEA. Go to Settings (Ctrl+Alt+S; Mac: Cmd+,) → Plugins.
- Open the Marketplace tab. Search GitHub Copilot. Click Install.
- Click Restart IDE.
- After restart, open Tools → GitHub Copilot → Login to GitHub.
- In the dialog, click Copy and Open. A browser page opens.
- Sign in to GitHub, paste the device code, click Continue.
- Click Authorize GitHub Copilot Plugin. Back in the IDE, click OK.
Settings
Open Settings → Languages & Frameworks → GitHub Copilot (names can move slightly between plugin versions).
- Completions: turn inline suggestions on or off, or turn them off for one language.
- Status icon: click the Copilot icon in the bottom status bar to pause completions quickly.
- Chat: open the GitHub Copilot Chat tool window on the right side.
- Mode: in chat, pick a mode such as Ask or Agent. Start with Ask, move to Agent when you are comfortable.
- Model: pick a model in the chat box model list (the list depends on your plan).
Configuration
- Project rules: add
.github/copilot-instructions.mdwith rules like “Java 21, JUnit 5, Maven, no Lombok”. - Company proxy: set it in Settings → Appearance & Behavior → System Settings → HTTP Proxy.
- Content exclusion (Business/Enterprise): admins can stop Copilot reading chosen files in GitHub org settings.
# Rules for Copilot - Java 21, Maven, JUnit 5 - Use records for simple data classes - Every public method needs a unit test - Never log passwords or tokens
First test (5 minutes)
- Create a Java class
PasswordCheck. - Type the comment
// return true if pw has 8+ chars, an upper, a lower and a digitand start the method line. - Grey ghost text appears. Press Tab to accept, Esc to reject.
- Open Copilot Chat. Ask: “Write JUnit 5 tests for PasswordCheck.isStrong, including null.”
- Run the tests with the green arrow. Keep the code only if they pass.
- Other way in: recent JetBrains AI Assistant versions can also run GitHub Copilot as an agent in AI Chat (sign in with GitHub). The plugin is the full experience.
- Remote Development: the AI Chat agent route needs a browser login, so it does not work in JetBrains Remote Development sessions.
Quick quiz
1. Where do you install the plugin?
Settings → Plugins → Marketplace, search GitHub Copilot.
2. How do you log in after restart?
Tools → GitHub Copilot → Login to GitHub, then the device code in the browser.
3. Which key accepts a suggestion?
Tab.
4. Which file holds Copilot project rules?
.github/copilot-instructions.md.
Save tokens and money
Use inline for small code. It is the cheapest. Keep chat questions short and select only the method you need. On paid plans, premium models use more of your request allowance, so use the default model for easy tasks.