copilot-cli README

The project's README from github.com/github/copilot-cli. As one markdown file: README.md.

GitHub Copilot CLI

The power of GitHub Copilot, now in your terminal.

GitHub Copilot CLI brings AI-powered coding assistance directly to your command line, enabling you to build, debug, and understand code through natural language conversations. Powered by the same agentic harness as GitHub's Copilot coding agent, it provides intelligent assistance while staying deeply integrated with your GitHub workflow.

See our official documentation for more information.

Image of the splash screen for the Copilot CLI

🚀 Introduction and Overview

We're bringing the power of GitHub Copilot coding agent directly to your terminal. With GitHub Copilot CLI, you can work locally and synchronously with an AI agent that understands your code and GitHub context.

We're still early in our journey, but with your feedback, we're rapidly iterating to make the GitHub Copilot CLI the best possible companion in your terminal.

📦 Getting Started

Supported Platforms

Prerequisites

If you have access to GitHub Copilot via your organization or enterprise, you cannot use GitHub Copilot CLI if your organization owner or enterprise administrator has disabled it in the organization or enterprise settings. See Managing policies and features for GitHub Copilot in your organization for more information.

Installation

Install with the install script (macOS and Linux):

curl -fsSL https://gh.io/copilot-install | bash

Or

wget -qO- https://gh.io/copilot-install | bash

Use | sudo bash to run as root and install to /usr/local/bin.

Set PREFIX to install to $PREFIX/bin/ directory. Defaults to /usr/local when run as root or $HOME/.local when run as a non-root user.

Set VERSION to install a specific version. Defaults to the latest version.

For example, to install version v0.0.369 to a custom directory:

curl -fsSL https://gh.io/copilot-install | VERSION="v0.0.369" PREFIX="$HOME/custom" bash

Install with Homebrew (macOS and Linux):

brew install copilot-cli
brew install copilot-cli@prerelease

Install with WinGet (Windows):

winget install GitHub.Copilot
winget install GitHub.Copilot.Prerelease

Install with npm (macOS, Linux, and Windows):

npm install -g @github/copilot
npm install -g @github/copilot@prerelease

Launching the CLI

copilot

On first launch, you'll be greeted with our adorable animated banner! If you'd like to see this banner again, launch copilot with the --banner flag.

If you're not currently logged in to GitHub, you'll be prompted to use the /login slash command. Enter this command and follow the on-screen instructions to authenticate.

Authenticate with a Personal Access Token (PAT)

You can also authenticate using a fine-grained PAT with the "Copilot Requests" permission enabled.

  1. Visit https://github.com/settings/personal-access-tokens/new
  2. Under "Permissions," click "add permissions" and select "Copilot Requests"
  3. Generate your token
  4. Add the token to your environment via the environment variable GH_TOKEN or GITHUB_TOKEN (in order of precedence)

Using the CLI

Launch copilot in a folder that contains code you want to work with.

By default, copilot utilizes Claude Sonnet 4.5. Run the /model slash command to choose from other available models, including Claude Sonnet 4 and GPT-5.

Experimental Mode

Experimental mode enables access to new features that are still in development. You can activate experimental mode by:

Once activated, the setting is persisted in your config, so the --experimental flag is no longer needed on subsequent launches.

Experimental Features

Each time you submit a prompt to GitHub Copilot CLI, your monthly quota of premium requests is reduced by one. For information about premium requests, see About premium requests.

For more information about how to use the GitHub Copilot CLI, see our official documentation.

🔧 Configuring LSP Servers

GitHub Copilot CLI supports Language Server Protocol (LSP) for enhanced code intelligence. This feature provides intelligent code features like go-to-definition, hover information, and diagnostics.

Installing Language Servers

Copilot CLI does not bundle LSP servers. You need to install them separately. For example, to set up TypeScript support:

npm install -g typescript-language-server

For other languages, install the corresponding LSP server and configure it following the same pattern shown below.

Configuring LSP Servers

LSP servers are configured through a dedicated LSP configuration file. You can configure LSP servers at the user level or repository level:

User-level configuration (applies to all projects): Edit ~/.copilot/lsp-config.json

Repository-level configuration (applies to specific project): Create .github/lsp.json in your repository root

Example configuration:

{
  "lspServers": {
    "typescript": {
      "command": "typescript-language-server",
      "args": ["--stdio"],
      "fileExtensions": {
        ".ts": "typescript",
        ".tsx": "typescript"
      }
    }
  }
}

Viewing LSP Server Status

Check configured LSP servers using the /lsp command in an interactive session, or view your configuration files directly.

For more information, see the changelog.

📢 Feedback and Participation

We're excited to have you join us early in the Copilot CLI journey.

We're building quickly. Expect frequent updates--please keep your client up to date for the latest features and fixes!

Your insights are invaluable! Open an issue in this repo, join Discussions, and run /feedback from the CLI to submit a confidential feedback survey!

copilot-cli (github/copilot-cli)

Searching Database…

这是什么?GitHub Copilot CLI 把 GitHub Copilot 的智能编程助手带进你的终端,让你用自然语言编写、调试和理解代码,同时与你的 GitHub 仓库、Issue 和 PR 保持集成。
它是独立的 CLI 应用,还是需要导入到我代码中的库?它是一个独立的终端应用,你可以启动它并与之交互式对话,底层使用的是与 GitHub Copilot 编码智能体相同的智能体框架。
我该如何安装和运行它?可以通过 macOS/Linux 上的安装脚本、Homebrew、Windows 上的 WinGet,或在这三个平台中任意一个上使用 npm 安装。然后在项目文件夹中运行 'copilot',并使用斜杠命令 '/login' 登录。
使用它需要 Copilot 订阅吗?需要。你必须拥有有效的 GitHub Copilot 订阅,或拥有组织/企业的访问权限且未被管理员禁用;在 Windows 上还需要 PowerShell v6+。
即使我有 Copilot,组织也能阻止我使用它吗?可以。如果组织所有者或企业管理员在组织/企业设置中禁用了 Copilot CLI,即使你有订阅,也无法使用它。
它会在未经询问的情况下对我的代码执行操作吗?不会。智能体提出的每项操作都会先展示给你预览,并且在执行前需要你明确批准。
我可以使用哪些 AI 模型?默认使用 Claude Sonnet 4.5,但你可以通过斜杠命令 '/model' 切换到其他模型,例如 Claude Sonnet 4 或 GPT-5。
它能通过外部工具扩展功能吗?可以。它默认内置 GitHub 的 MCP 服务器,也支持连接自定义 MCP 服务器,以获得更多功能。
什么是 Autopilot 模式?这是一种实验性模式(通过 '--experimental' 参数启用),它会让智能体持续处理任务直到完成,可以用 Shift+Tab 切换。
它支持跳转到定义之类的代码智能功能吗?支持。它支持语言服务器协议(LSP)服务器,但你需要自行安装 LSP 服务器,并通过 '.copilot/lsp-config.json' 或仓库级的 '.github/lsp.json' 文件进行配置。
What are similar projects?Baize, headroom, git-ai, kimi-code, qwen-code, claurst, superset, openrig
Creator
github
Size
0.4 MB
Stars
11.3K
Age
3y
Commits · 90 Days