← 返回命令列表

Linux command

copilot 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Start an interactive session

copilot

Start with an initial prompt

copilot "[prompt]"

Run a one-off command

copilot -p "[prompt]"

Continue the most recent

copilot --continue

Resume a specific session

copilot --resume

Reference specific files

copilot "Explain @[path/to/file.js]"

Run shell commands directly

copilot "![git status]"

说明

GitHub Copilot CLI brings AI-powered coding assistance directly to your terminal, enabling natural language conversations to build, debug, and understand code. It operates as an agentic coding assistant that can read, write, and execute code in your development environment. The tool works in two main modes: interactive mode for extended sessions with ongoing dialogue, and programmatic mode (-p) for scripted automation and one-off commands. Copilot can navigate codebases, edit files, run shell commands, and perform complex multi-step development tasks. Special syntax includes @ for file references (e.g., @src/app.js) and ! for direct shell command execution without model calls. The CLI supports tab completion for paths and maintains conversation history across sessions.

参数

-p, --prompt
Print mode: process prompt and exit without interactive session.
--continue
Continue the most recently closed local session.
--resume
Cycle through and resume local and remote interactive sessions.
--allow-all-paths
Disable path verification for shell commands.
--allow-all-urls
Disable URL verification for external access.
--allow-url _domain_
Pre-approve specific domains for web access (e.g., --allow-url github.com).
--agent _agent-name_
Specify a custom agent to use for the session.

FAQ

What is the copilot command used for?

GitHub Copilot CLI brings AI-powered coding assistance directly to your terminal, enabling natural language conversations to build, debug, and understand code. It operates as an agentic coding assistant that can read, write, and execute code in your development environment. The tool works in two main modes: interactive mode for extended sessions with ongoing dialogue, and programmatic mode (-p) for scripted automation and one-off commands. Copilot can navigate codebases, edit files, run shell commands, and perform complex multi-step development tasks. Special syntax includes @ for file references (e.g., @src/app.js) and ! for direct shell command execution without model calls. The CLI supports tab completion for paths and maintains conversation history across sessions.

How do I run a basic copilot example?

Run `copilot` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -p, --prompt do in copilot?

Print mode: process prompt and exit without interactive session.