# GitHub Copilot

**GitHub Copilot** 是一款 AI 辅助软件开发工具，最初被描述为“AI 结对程序员”，能在开发者输入代码时建议整行乃至整个函数的代码，此后又扩展出聊天、[代码审查](https://www.edgepedia.org/zh/code-review)和自主智能体等功能，覆盖各类 IDE、终端、GitHub.com 和移动端。它于 2021 年 6 月 29 日由 GitHub 与 OpenAI 合作发布技术预览版，最初由 OpenAI Codex 驱动，该模型在一个大量集中于公开源代码的数据集上训练而成。<sup>[1](https://github.blog/news-insights/product-news/introducing-github-copilot-ai-pair-programmer/)</sup><sup> • </sup><sup>[2](https://www.axios.com/2021/07/02/github-openai-copilot-automated-programming)</sup>

| 关键事实 | 详情 |
|---|---|
| 发布 | 2021 年 6 月 29 日宣布技术预览版，由 GitHub 与 OpenAI 共同开发，由 OpenAI Codex 驱动<sup>[1](https://github.blog/news-insights/product-news/introducing-github-copilot-ai-pair-programmer/)</sup> |
| 对照实验 | 95 名专业开发者用 JavaScript 编写 HTTP 服务器：使用 Copilot 者完成速度快 55.8%，即 1 小时 11 分钟对 2 小时 41 分钟（P=.0017，95% CI [21%, 89%]）<sup>[3](https://github.blog/news-insights/research/research-quantifying-github-copilots-impact-on-developer-productivity-and-happiness/)</sup> |
| 实地实验 | 在微软和埃森哲开展的两项随机试验，涉及 1,974 名开发者；实验组开发者每周完成的拉取请求在微软增加 12.92% 至 21.83%，在埃森哲增加 7.51% 至 8.69%<sup>[4](https://mit-genai.pubpub.org/pub/v5iixksv/download/pdf)</sup> |
| 安全性发现 | 一项针对 GitHub 项目中 Copilot 生成代码的实证研究发现，29.6% 的代码片段存在安全弱点，涵盖 38 个 CWE 类别<sup>[5](https://www.veracode.com/wp-content/uploads/2024/07/2310.02059v2.pdf)</sup> |
| 反证 | METR 于 2025 年开展的一项随机对照试验发现，经验丰富的开源开发者在使用 2025 年初的 AI 工具时，平均耗时反而增加 19%<sup>[6](https://www.itpro.com/software/development/think-ai-coding-tools-are-speeding-up-work-think-again-theyre-actually-slowing-developers-down)</sup> |
| 个人套餐（2026 年 6 月） | Pro 每月 10 美元，含总额 15 美元用量；Pro+ 每月 39 美元，含 70 美元；新增 Max 套餐每月 100 美元，含 200 美元<sup>[7](https://github.blog/news-insights/company-news/github-copilot-individual-plans-introducing-flex-allotments-in-pro-and-pro-and-a-new-max-plan/)</sup> |

## 起源与发布

GitHub 于 2021 年 6 月 29 日宣布 Copilot 技术预览版，称其为一名 AI 结对程序员，能从开发者正在处理的代码中提取上下文，建议整行或整个函数，帮助编写测试，并在无需手动网络搜索的情况下呈现替代方案和新 API。<sup>[1](https://github.blog/news-insights/product-news/introducing-github-copilot-ai-pair-programmer/)</sup> 其底层系统 OpenAI Codex 在从 GitHub 抓取的数 TB 公开可用代码上训练，并利用该训练在开发者编程时推荐代码。<sup>[2](https://www.axios.com/2021/07/02/github-openai-copilot-automated-programming)</sup> 发布时的报道指出两个直接关切：一是 Copilot 有时可能推荐逐字取自其开源训练集的代码，从而引发版权问题；二是它代表的是对程序员部分而非全部工作量的辅助性自动化。<sup>[2](https://www.axios.com/2021/07/02/github-openai-copilot-automated-programming)</sup>

这款工具的到来也对开源开发本身产生了可测量的影响。一项自然实验研究利用 Copilot 在 2021 年 10 月发布时选择性推出 Python 支持（而未推出 R 语言支持）这一特点，发现 Copilot 对维护类贡献的提升显著大于对代码开发类贡献的提升——前者多为基于他人工作迭代的任务，后者多为独立的原创任务。<sup>[8](https://arxiv.org/abs/2409.08379)</sup>

## 界面与智能体功能

Copilot 起初只是编辑器中的行内代码补全，后来扩展为一组共享同一底层 SDK 和平台基础组件的界面。GitHub 的文档针对不同类型的工作列出了不同的入口：IDE 用于交互式编写与完善，GitHub Copilot CLI 用于终端优先的工作流和并行运行复杂命令，GitHub Copilot 应用用于跨代码仓库和工作流协调智能体工作，GitHub Mobile 用于离开工位时快速提问，GitHub 网站用于从议题或拉取请求开始的工作，GitHub Copilot SDK 则用于构建直接调用 Copilot 的应用程序。<sup>[9](https://docs.github.com/en/copilot/get-started/where-to-use-github-copilot)</sup>

**智能体模式**将助手从建议扩展到自主编辑。在智能体模式下，Copilot 决定要更改哪些文件，提供代码更改和终端命令以完成任务，并反复迭代以修复问题，直至任务完成；开发者可以用后续提示重新引导智能体，并对每条提议的终端命令予以确认或拒绝。该模式在 [Visual Studio Code](https://www.edgepedia.org/zh/visual-studio-code)、Visual Studio、JetBrains IDE、Xcode 和 Eclipse 中可用，并可通过模型上下文协议（MCP）服务器扩展，为外部系统和 GitHub 本身添加工具。在智能体模式下输入的每条提示都会消耗 GitHub AI Credits。<sup>[10](https://docs.github.com/en/copilot/how-tos/copilot-in-your-ide/use-copilot-agents/use-agent-mode?tool=visualstudio)</sup> 在 JetBrains IDE 中，开发者可以通过 GitHub Copilot 插件、JetBrains AI Assistant，或集成终端中的 Copilot CLI 使用 Copilot；该插件涵盖行内建议与下一次编辑建议、聊天、智能体功能、行内聊天、代码审查和提交信息生成。<sup>[11](https://docs.github.com/en/copilot/concepts/copilot-surfaces/copilot-in-ides)</sup>

同一项工作可以在不同界面之间流转：一项任务可以在 GitHub 上以议题形式开始，被分配给 Copilot 云端智能体，在 Copilot 应用中被跟踪，在 IDE 中作为拉取请求接受审查，最后在网页界面中合并。<sup>[9](https://docs.github.com/en/copilot/get-started/where-to-use-github-copilot)</sup>

## 生产力研究

被引用最多的生产力结果来自 GitHub Next 与微软首席经济学家办公室合作开展的一项对照实验。95 名熟悉 [JavaScript](https://www.edgepedia.org/zh/javascript) 的专业开发者被随机分为两组，在实现 HTTP 服务器时计时，提交内容通过 GitHub Classroom 自动评分。Copilot 组完成任务快 55%，平均 1 小时 11 分钟，对照组为 2 小时 41 分钟，结果具有统计显著性（P=.0017），速度提升的 95% 置信区间为 [21%, 89%]。<sup>[3](https://github.blog/news-insights/research/research-quantifying-github-copilots-impact-on-developer-productivity-and-happiness/)</sup> 同一研究项目还发现，开发者普遍认为 Copilot 帮助他们更快完成任务，尤其是重复性任务，让工具承担重复性工作减轻了认知负荷。<sup>[3](https://github.blog/news-insights/research/research-quantifying-github-copilots-impact-on-developer-productivity-and-happiness/)</sup>

**实地实验**在真实工作场所检验了这些效应。两项随机对照试验向微软和[埃森哲](https://www.edgepedia.org/zh/accenture)约两千名软件开发者授予 Copilot 访问权限；初步结果发现，实验组开发者每周完成的拉取请求在微软增加 12.92% 至 21.83%，在埃森哲增加 7.51% 至 8.69%，不过作者指出这些实验的统计功效不足，估计值仅在某些设定下达到统计显著性。<sup>[4](https://mit-genai.pubpub.org/pub/v5iixksv/download/pdf)</sup> 一项相关实验涉及微软、埃森哲以及一家匿名的《财富》100 强电子制造公司的 4,867 名开发者，发现使用 GitHub Copilot 使日常业务中的拉取请求增加了 26%。<sup>[12](https://www.microsoft.com/en-us/research/wp-content/uploads/2024/12/NFWReport2024_1.27.2025.pdf)</sup>

结果并非一致向好。在大型公共部门敏捷组织 NAV IT 开展的一项纵向混合方法案例研究，分析了两年间来自 703 个代码仓库的 26,317 条唯一非合并提交，比较了 25 名 Copilot 用户与 14 名非用户。<sup>[13](https://arxiv.org/abs/2509.20353)</sup> 另外，评估机构 METR 开展了一项随机对照试验，16 名经验丰富的开源开发者（每人至少有五年经验）处理自己代码仓库中的 246 个真实议题；开发者在使用 2025 年初的 AI 工具时平均耗时增加 19%，尽管他们此前预测这些工具会加快速度。METR 自己将该结果定位为 AI 能力在单一环境下的单次快照。<sup>[6](https://www.itpro.com/software/development/think-ai-coding-tools-are-speeding-up-work-think-again-theyre-actually-slowing-developers-down)</sup> 一项更广泛的文献综述发现，此类助手确实能可靠地加快生成样板代码、搭建脚手架和执行重复性代码更改，但它们对开放式设计工作和调试的影响较弱或不一致。<sup>[14](https://ijsrst.com/paper/14223.pdf)</sup>

## 生成代码的安全性

由于 Copilot 的底层模型在数十亿行公开开源代码（包括含有不安全模式的代码）上训练，其建议的安全性已被广泛研究。一项实证研究从真实 GitHub 项目中收集 Copilot 生成的代码，并用静态分析工具加以分析，发现 29.6% 的 Copilot 生成代码片段存在安全弱点，涵盖 38 个不同的 CWE 类别，其中最常见的是 CWE-330（使用随机性不足的值）、CWE-78（操作系统命令注入）和 CWE-94（代码生成控制不当，即代码注入）；所识别出的 CWE 中有八个属于 2023 年 CWE Top-25。<sup>[5](https://www.veracode.com/wp-content/uploads/2024/07/2310.02059v2.pdf)</sup> 一项比较研究得出结论：尽管 Copilot 在不同漏洞类型上表现各异，但在引入漏洞方面没有人类开发者那么糟，因为在相当多的情况下它并未复制人类此前引入的漏洞。<sup>[16](https://arxiv.org/abs/2204.04741)</sup>

GitHub 自家的代码审查功能也受到了评估。一项 2026 年的研究使用来自开源项目的带标签漏洞代码样本，发现 Copilot 的代码审查经常无法检测出 SQL 注入、跨站脚本和不安全的反序列化等关键漏洞，其反馈主要针对编码风格和拼写错误等低严重度问题。<sup>[17](https://proceedings.mlr.press/v318/amro26a.html)</sup> GitHub 表示，Copilot 用户有责任确保其代码的安全性和质量。<sup>[5](https://www.veracode.com/wp-content/uploads/2024/07/2310.02059v2.pdf)</sup>

## 计费与套餐

Copilot 的定价在 2026 年发生了重大变化。2026 年 6 月 1 日，所有 Copilot 套餐转为按用量计费，以 GitHub AI Credits 取代高级请求系统，其中 1 个 AI 积分等于 0.01 美元，用量根据 token 消耗计算，包括输入、输出和缓存 token。

**个人套餐**于同日重构。每月包含的用量现由两部分组成：与订阅价格 1:1 匹配的基础积分（永不改变），以及弹性配额——一种可变的额外额度，旨在随着模型定价、新模型和效率提升使 AI 经济性演变而调整。截至 2026 年 6 月 1 日，Pro 包含 10 美元基础积分加 5 美元弹性配额，合计 15 美元；Pro+ 包含 39 美元基础积分加 31 美元弹性配额，合计 70 美元；面向持续高强度工作的新 Max 套餐包含 100 美元基础积分加 100 美元弹性配额，合计 200 美元。代码补全和下一次编辑建议在付费套餐中仍不限量，且不消耗积分。<sup>[7](https://github.blog/news-insights/company-news/github-copilot-individual-plans-introducing-flex-allotments-in-pro-and-pro-and-a-new-max-plan/)</sup> 免费套餐 GitHub Copilot Free 提供有限功能，包括每月有限次数的代码补全以及有限的聊天和智能体用量。<sup>[7](https://github.blog/news-insights/company-news/github-copilot-individual-plans-introducing-flex-allotments-in-pro-and-pro-and-a-new-max-plan/)</sup><sup> • </sup><sup>[18](https://github.com/features/copilot/plans?ref_plan=cfi&ref_product=copilot&ref_style=button&ref_type=purchase)</sup>

代码审查也纳入了计费体系：自 2026 年 6 月 1 日起，Copilot 代码审查除消耗 GitHub AI Credits 外，还消耗 [GitHub Actions](https://www.edgepedia.org/zh/github-actions) 分钟数，公共仓库不受影响，其 Actions 分钟数仍然免费。<sup>[19](https://github.blog/changelog/2026-04-27-github-copilot-code-review-will-start-consuming-github-actions-minutes-on-june-1-2026/)</sup><sup> • </sup><sup>[20](https://github.blog/changelog/2026-06-01-updates-to-github-copilot-billing-and-plans/)</sup>

## 版权与训练数据

对训练数据的担忧早于产品的正式发布。发布之初，一些程序员担心 Copilot 可能推荐逐字取自其开源训练集的代码，这意味着自由许可的代码被重新包装进商业模型。<sup>[2](https://www.axios.com/2021/07/02/github-openai-copilot-automated-programming)</sup> GitHub 的套餐页面指出，用户已在训练数据使用方式的变更生效前 30 天收到通知，并可随时在 GitHub 账户设置中选择不让自己的数据用于训练。<sup>[18](https://github.com/features/copilot/plans?ref_plan=cfi&ref_product=copilot&ref_style=button&ref_type=purchase)</sup>

## References

1. [Introducing GitHub Copilot: your AI pair programmer, The GitHub Blog (June 29, 2021)](https://github.blog/news-insights/product-news/introducing-github-copilot-ai-pair-programmer/)
2. [Programs that write programs, Axios (July 2, 2021)](https://www.axios.com/2021/07/02/github-openai-copilot-automated-programming)
3. [Research: quantifying GitHub Copilot's impact on developer productivity and happiness, The GitHub Blog](https://github.blog/news-insights/research/research-quantifying-github-copilots-impact-on-developer-productivity-and-happiness/)
4. [The Productivity Effects of Generative AI: Evidence from a Field Experiment with GitHub Copilot, MIT Exploration of Generative AI](https://mit-genai.pubpub.org/pub/v5iixksv/download/pdf)
5. [Security Weaknesses of Copilot-Generated Code in GitHub Projects: An Empirical Study](https://www.veracode.com/wp-content/uploads/2024/07/2310.02059v2.pdf)
6. [Think AI coding tools are speeding up work? Think again, IT Pro (July 2025)](https://www.itpro.com/software/development/think-ai-coding-tools-are-speeding-up-work-think-again-theyre-actually-slowing-developers-down)
7. [GitHub Copilot individual plans: flex allotments in Pro and Pro+, and a new Max plan, The GitHub Blog (May 12, 2026)](https://github.blog/news-insights/company-news/github-copilot-individual-plans-introducing-flex-allotments-in-pro-and-pro-and-a-new-max-plan/)
8. [The Impact of Large Language Models on Open-source Innovation: Evidence from GitHub Copilot, arXiv:2409.08379](https://arxiv.org/abs/2409.08379)
9. [Where to use GitHub Copilot, GitHub Docs](https://docs.github.com/en/copilot/get-started/where-to-use-github-copilot)
10. [Using agent mode in your IDE, GitHub Docs](https://docs.github.com/en/copilot/how-tos/copilot-in-your-ide/use-copilot-agents/use-agent-mode?tool=visualstudio)
11. [GitHub Copilot in IDEs, GitHub Docs](https://docs.github.com/en/copilot/concepts/copilot-surfaces/copilot-in-ides)
12. [Generative AI is likely creating marked productivity gains for developers, Microsoft Research NFW Report (2024)](https://www.microsoft.com/en-us/research/wp-content/uploads/2024/12/NFWReport2024_1.27.2025.pdf)
13. [Developer Productivity With and Without GitHub Copilot: A Longitudinal Mixed-Methods Case Study, arXiv:2509.20353](https://arxiv.org/abs/2509.20353)
14. [GitHub Copilot: productivity, code quality and security in AI-assisted development, IJSRST](https://ijsrst.com/paper/14223.pdf)
15. [Asleep at the Keyboard? Assessing the Security of GitHub Copilot's Code Contributions, Communications of the ACM](https://doi.org/10.1145%2F3610721)
16. [Is GitHub's Copilot as Bad as Humans at Introducing Vulnerabilities in Code?, arXiv:2204.04741](https://arxiv.org/abs/2204.04741)
17. [GitHub's Copilot Code Review: Can AI Spot Security Flaws Before You Commit?, PMLR 318:825-832 (2026)](https://proceedings.mlr.press/v318/amro26a.html)
18. [GitHub Copilot Plans & pricing, GitHub](https://github.com/features/copilot/plans?ref_plan=cfi&ref_product=copilot&ref_style=button&ref_type=purchase)
19. [GitHub Copilot code review will start consuming GitHub Actions minutes on June 1, 2026, GitHub Changelog](https://github.blog/changelog/2026-04-27-github-copilot-code-review-will-start-consuming-github-actions-minutes-on-june-1-2026/)
20. [Updates to GitHub Copilot billing and plans, GitHub Changelog (June 1, 2026)](https://github.blog/changelog/2026-06-01-updates-to-github-copilot-billing-and-plans/)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 30, 2026; Oct 15, 2026 · Edited: Oct 11, 2026; Oct 15, 2026 · Last review: Oct 15, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 现代人工智能：基础模型、生成式人工智能与人工智能产业 › Model families and named models › Code models and coding agents

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/github-copilot

English original: https://www.edgepedia.org/github-copilot
