Ravindra BagaleCourses & study guides Track your progress
AI CODING ASSISTANTS · CHAPTER 2 · SETUP

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

WHY

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

WHAT
  • 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

1 · Install plugin Settings → Plugins → Marketplace 2 · Restart IDE click Restart IDE 3 · Login to GitHub Tools → GitHub Copilot 4 · Device code Copy and Open, paste, Authorize 5 · First suggestion type, press Tab

Install steps

HOW
  1. Open IntelliJ IDEA. Go to Settings (Ctrl+Alt+S; Mac: Cmd+,) → Plugins.
  2. Open the Marketplace tab. Search GitHub Copilot. Click Install.
  3. Click Restart IDE.
  4. After restart, open Tools → GitHub Copilot → Login to GitHub.
  5. In the dialog, click Copy and Open. A browser page opens.
  6. Sign in to GitHub, paste the device code, click Continue.
  7. 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).

  1. Completions: turn inline suggestions on or off, or turn them off for one language.
  2. Status icon: click the Copilot icon in the bottom status bar to pause completions quickly.
  3. Chat: open the GitHub Copilot Chat tool window on the right side.
  4. Mode: in chat, pick a mode such as Ask or Agent. Start with Ask, move to Agent when you are comfortable.
  5. Model: pick a model in the chat box model list (the list depends on your plan).

Configuration

  1. Project rules: add .github/copilot-instructions.md with rules like “Java 21, JUnit 5, Maven, no Lombok”.
  2. Company proxy: set it in Settings → Appearance & Behavior → System Settings → HTTP Proxy.
  3. Content exclusion (Business/Enterprise): admins can stop Copilot reading chosen files in GitHub org settings.
.github/copilot-instructions.md
# 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)

  1. Create a Java class PasswordCheck.
  2. Type the comment // return true if pw has 8+ chars, an upper, a lower and a digit and start the method line.
  3. Grey ghost text appears. Press Tab to accept, Esc to reject.
  4. Open Copilot Chat. Ask: “Write JUnit 5 tests for PasswordCheck.isStrong, including null.”
  5. 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.
Rule: review agent changes in the diff before you accept. Keep secrets out of the project folder.

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

SMART AI USE

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.

Save these cards

INTERVIEW CARDAI Coding

How to set up Copilot in IntelliJ?

Plugins → Marketplace → GitHub Copilot → Restart.
Tools → GitHub Copilot → Login to GitHub → device code.
Ravindra Bagale · ravindrabagale.com/ai-coding
COMPARISON CARDAI Coding

Copilot: VS Code vs IntelliJ

VS Code: extension, sign in with GitHub.
IntelliJ: plugin, device-code login. Same inline, chat and agent ideas.
Ravindra Bagale · ravindrabagale.com/ai-coding
REVISION CARDAI Coding

Setup in 4

Install → Restart → Login (device code) → Tab to accept.
Rules in .github/copilot-instructions.md.
Ravindra Bagale · ravindrabagale.com/ai-coding