GitHub Copilot 在 IDEA / PyCharm 裏怎麼用:JetBrains 插件安裝、登入與 Agent 模式

IDEA 安裝 GitHub Copilot 教學:支持哪些 JetBrains IDE、在插件市場安裝、用裝置碼登入 GitHub、打開 Chat 和 Agent 模式、接 MCP,以及登入失敗、看不到 Agent 選項等常見問題,按 GitHub 官方文檔整理。

NNathaniel bigo··原創首發·AI 輔助撰寫
9 分鐘讀完
資料核對於 2026-10-11 · 依據官方文檔與公開資料整理 免費帳號 帳號

結論先說

  1. 在 IDE 的 Plugins → Marketplace 裏搜 GitHub Copilot 安裝,重啟 IDE。
  2. 登入入口:Tools → GitHub Copilot → Login to GitHub,用裝置碼在瀏覽器裏授權。
  3. JetBrains 裏同樣有 Chat 和 Agent 模式:點 Copilot 圖標打開聊天面板,在頂部切到 Agent 標籤。
  4. 聊天和 Agent 消耗 AI credits;官方建議 JetBrains 插件版本不低於 1.9.1,否則用量資訊可能顯示不準。
  5. 沒有 Copilot 訂閱可以先用 Copilot Free。
本文根據 GitHub 官方文檔《Installing the GitHub Copilot extension in your environment》(JetBrains 部分)和《Using agent mode in your IDE》整理,資料核對於 2026-10-11。

適用於誰

  • 用 IntelliJ IDEA、PyCharm、WebStorm、GoLand 等 JetBrains IDE,不想換編輯器的人;
  • 搜「idea 安裝 github copilot」「github copilot idea 使用」「github copilot idea agent mode」的人。

支持哪些 IDE

官方列出的兼容名單:IntelliJ IDEA(Ultimate、Community、Educational)、Android Studio、CLion、DataGrip、DataSpell、GoLand、MPS、PhpStorm、PyCharm(Professional、Community、Educational)、Rider、RubyMine、RustRover、WebStorm,以及 Code With Me Guest 和 JetBrains Client。

具體到「哪個插件版本配哪個 IDE 版本」,官方讓你看 JetBrains Marketplace 上 GitHub Copilot 插件的 Versions 頁。IDE 太舊時,Marketplace 裏會搜不到或提示不兼容,先升級 IDE。

步驟一:安裝插件

  1. 確認帳號能用 Copilot(付費訂閱、組織分配的席位,或 Copilot Free);
  2. 打開 IDE 的設定,進入 Plugins,在 Marketplace 裏搜尋 GitHub Copilot,點 Install;
  3. 安裝完成後點 Restart IDE。

官方文檔順帶說明:這個插件的許可方是 GitHub 而不是 JetBrains,使用即表示同意 GitHub 的附加產品條款。

步驟二:登入 GitHub

  1. 重啟後點選單 Tools → GitHub Copilot → Login to GitHub;

JetBrains IDE 的 Tools 選單展開後,GitHub Copilot 子選單裏高亮的「Login to GitHub」選項

圖片來源:GitHub 官方文檔《Installing the GitHub Copilot extension in your environment》

  1. 在彈出的 Sign in to GitHub 對話框裏點 Copy and Open——它會複製一串裝置碼並打開瀏覽器;
  2. 瀏覽器裏如果要求登入,就登入你的 GitHub 帳號;
  3. 粘貼裝置碼,點 Continue;
  4. 在權限確認頁點 Authorize GitHub Copilot Plugin;
  5. 回到 IDE,看到確認提示後點 OK。

公司用 GHE.com 託管帳號的,登入前要先改一項設定,見官方的《Using GitHub Copilot with an account on GHE.com》。

步驟三:補全、Chat 與 Agent

補全:正常寫代碼即可,灰色建議出現後按 Tab 接受。從上圖的選單能看到,Tools → GitHub Copilot 裏可以對全部語言或當前語言停用補全(Disable Completions / Disable Completions for 某語言)。

Chat:在側邊欄或選單裏找到 Copilot Chat,直接提問。它能看到你當前打開的文件。

Agent 模式:

  1. 點 Copilot 圖標打開聊天面板;
  2. 在面板頂部點 Agent 標籤;
  3. 輸入任務。Copilot 會在編輯器裏流式給出修改、更新工作集,必要時建議終端命令;
  4. 查看修改;對它建議的命令逐條確認是否允許運行,之後它會繼續迭代直到完成。

官方說 Agent 模式最適合三種情況:任務複雜、包含多步和報錯處理;你希望由 Copilot 自己決定步驟;任務需要接外部系統(比如 MCP 伺服器)。任務大或需求模糊時,官方建議先用 Plan 模式起草實施方案。

Agent 工作過程中可以繼續發消息改變方向,也可以拒絕它提出的某條命令。

進階:換模型、接 MCP、項目指令

  • 換模型 / 自定義 Agent:提交任務前可以在聊天面板裏切換模型,或選擇為某類工作定製的 custom agent。Free 和 Student 檔只能用自動選模型。
  • MCP:Agent 的能力很大一部分來自工具,可以通過 MCP 伺服器擴展,GitHub 官方提供了 GitHub MCP Server 用來在編輯器裏操作 GitHub。
  • 項目指令:倉庫裏的 .github/copilot-instructions.md 會自動帶進請求,見《copilot-instructions.md 怎麼寫》。

常見問題

Q:聊天面板裏沒有 Agent 標籤?

先升級插件到最新版;如果是公司帳號,可能是管理員在策略裏關閉了 Agent 模式。

Q:登入時瀏覽器打不開或裝置碼過期?

重新點一次 Login to GitHub 獲取新碼;公司網絡攔截 github.com 的裝置授權頁時需要找 IT 放行。

Q:一定要裝這個插件嗎?

不一定。官方說明插件提供完整的 Copilot 體驗,但也可以通過 JetBrains AI Assistant 或 Copilot CLI 使用 Copilot,各入口的能力差別見官方《GitHub Copilot in IDEs》。命令行用法見《GitHub Copilot CLI 安裝與使用》。

Q:會不會很耗額度?

官方說明 Agent 模式下每條提示都消耗 AI credits,長對話、跨大量文件的任務消耗更多;補全在付費檔不計 credits。詳見《GitHub Copilot 免費版與 Pro 區別》。

參考資料

  • Installing the GitHub Copilot extension in your environment(GitHub 官方,JetBrains 標籤頁):https://docs.github.com/en/copilot/how-tos/copilot-in-your-ide/set-up-copilot/install-copilot-extension
  • Using agent mode in your IDE(GitHub 官方):https://docs.github.com/en/copilot/how-tos/copilot-in-your-ide/use-copilot-agents/use-agent-mode
  • Quickstart for using GitHub Copilot in your IDE(GitHub 官方):https://docs.github.com/en/copilot/get-started/quickstart-for-using-github-copilot-in-your-ide
  • GitHub Copilot 插件頁(JetBrains Marketplace):https://plugins.jetbrains.com/plugin/17718-github-copilot

Nathaniel 的更多內容

  1. 01

    GitHub Copilot VS Code 使用教學:開啟、登入、補全、Chat 提問與換帳號

    GitHub Copilot 在 VS Code 裏怎麼用?按 GitHub 與 VS Code 官方文檔講清怎麼開啟和登入(不用手動裝擴展)、沒訂閱會進入 Copilot Free、第一個補全與 Chat 提問、Agent 模式入口、切換帳號、查看用量和關閉 AI 功能。

    GitHub Copilot0
  2. 02

    Cursor 私隱模式與 Agent 權限:Privacy Mode 怎麼開、運行模式怎麼選、.cursorignore 保護密鑰

    Cursor 會拿我的代碼訓練嗎?按官方文檔講清 Privacy Mode 的含義與開啟步驟、哪些情況不適用零數據保留、Agent 的三種運行模式(Auto-review / Allowlist / Run Everything)、沙箱與讀取邊界,以及 .cursorignore 的作用與侷限。

    Cursor0
  3. 03

    Cursor 常見報錯與解決:Connection failed、high demand、模型不可用、Agent 超時、登入不上

    Cursor 報錯怎麼辦?按官方幫助中心整理:Connection failed 先跑網絡診斷並切 HTTP/1.1、suspicious activity、模型不可用、Agent Execution Timed Out、登入域名被攔、Tab 不出建議,以及怎麼導出日誌和 Request ID 反饋給官方。

    Cursor0
  4. 04

    GitHub Copilot Agent 模式怎麼用:IDE 裏的 Agent mode 與雲端 cloud agent 的區別

    GitHub Copilot Agent mode 教學:在 VS Code / JetBrains 裏怎麼開啟、適合什麼任務、怎麼中途糾正和審批命令、接 MCP 擴展工具;以及它和在 GitHub 上跑任務並提交 PR 的 Copilot cloud agent 有什麼不同、各自怎麼計費。

    GitHub Copilot0
  5. 05

    GitHub Copilot CLI 安裝與使用:npm / winget / brew 安裝、登入、常用指令與工具權限

    GitHub Copilot CLI 怎麼安裝、怎麼用?按官方文檔講清三種安裝方式(npm 需 Node.js 22+)、/login 登入與令牌登入、交互模式常用快捷鍵、copilot -p 非交互調用,以及 --allow-tool / --deny-tool 工具權限的寫法。

    GitHub Copilot0
  6. 06

    copilot-instructions.md 怎麼寫:用途、範例、按路徑生效的 instructions 文件與 AGENTS.md 的區別

    copilot-instructions.md 是什麼、放哪、怎麼寫?按 GitHub 官方文檔講清倉庫級指令、.github/instructions 下按路徑生效的 *.instructions.md(applyTo / excludeAgent)、AGENTS.md 三者的分工,附可改寫的中文範例與不生效排查。

    GitHub Copilot0

同產品的其他教學

  1. 01

    GitHub Copilot 學生認證怎麼申請:GitHub Education 條件、材料、激活 Copilot Student 與常見卡點

    GitHub Copilot 學生認證官方流程:誰有資格、要準備什麼證明材料、學校電郵的三種情況、在 Education benefits 頁提交申請、通過後怎麼激活 Copilot Student、它和 Pro 的區別,以及通過了卻仍顯示 Free 或付費頁時怎麼辦。

    GitHub Copilot0
  2. 02

    GitHub Copilot 免費版與 Pro、Pro+、Max 的區別:AI credits 額度怎麼算、怎麼查、用完了怎麼辦

    GitHub Copilot 免費額度有多少、Pro 和 Pro+ 差在哪?按 GitHub 官方文檔(2026-10-11)講清按 AI credits 計費的規則、各檔價格與每月額度、哪些功能扣 credits、每月 1 日重置、額度用完的三條路和遇到限流怎麼辦。

    GitHub Copilot0
  3. 03

    GitHub Copilot Code Review 怎麼用:PR 裏請求審查、自動審查、審查力度與自定義指令

    GitHub Copilot 代碼審查教學:在 PR 的 Reviewers 裏點 Request、應用建議與 Fix with Copilot、開啟自動審查、Lite / Balanced 兩檔審查力度、用 instructions 定製審查重點、哪些文件不審,以及計費方式,按 GitHub 官方文檔整理。

    GitHub Copilot0
  4. 04

    VS Code 必備 MCP Server 精選組合:工作區 mcp.json 寫法、作用域隔離與工具精選

    詳解 VS Code 精簡高效的四類 MCP Server 組合、.vscode/mcp.json 與用戶級作用域隔離區別、inputs 密鑰安全注入寫法,以及按場景精簡工具防上下文膨脹的方法。

    GitHub Copilot其他 AI 工具0
  5. 05

    Cherry Studio 接入 GitHub Models 與多端安裝包下載辨真:桌面與移動端支持說明

    詳解在 Cherry Studio 配置 GitHub Models 免費原型調試接口的 PAT 權限與端點寫法,並梳理桌面多平台安裝包校驗及移動端支持現狀,避開第三方篡改風險。

    GitHub Copilot其他 AI 工具0
  6. 06

    VS Code 做 Vibe Coding 怎麼配環境:AI 擴展搭配、終端自測閉環與規則文檔模板

    拆解在本地 VS Code 搭建高可控 Vibe Coding 工作台的完整配置:合理搭配 AI 編程擴展與終端代理、接入帶只讀與單項目護欄的 Supabase MCP、落地項目規範文檔,並用集成終端腳本構建改後即驗活的工程閉環。

    GitHub Copilot其他 AI 工具0

0 條評論

登入 後參與評論

還沒有評論,來搶沙發~