注意
欲了解 Copilot 云代理的概览,请参阅 关于 GitHub Copilot 云代理。
简介
您可以从以下来源请求 Copilot 创建新的拉取请求
- GitHub Issues,通过将问题指派给 Copilot
- GitHub 上的代理选项卡或面板
- GitHub 上的仪表盘
- Copilot Chat 在 Visual Studio Code、JetBrains IDE、Eclipse 和 Visual Studio 2026 中
- Copilot Chat 在 GitHub.com 上
- GitHub CLI
- 在 GitHub Mobile 上
- 您偏好的 IDE 或代理式编码工具,支持模型上下文协议(MCP)
- Raycast 启动器
- GitHub 上的 “新建仓库”表单
Copilot 将开始处理任务,打开拉取请求,完成后会请求您审阅。更多信息,请参见 关于 GitHub Copilot 云代理。
将问题指派给 Copilot
您可以通过将问题指派给 Copilot 来让其开始处理该问题。
您可以将问题指派给 Copilot
- 在 GitHub.com(请参阅下节)
- 在GitHub Mobile 上
- 通过 GitHub API(请参阅本文后面)
- 使用 Raycast 启动器
- 使用 GitHub CLI(请参阅
gh issue edit)
在 GitHub.com 上将问题指派给 Copilot
注意
此功能处于公开预览阶段,可能会有所变动。
-
在 GitHub 上,导航至仓库的主页面。
-
在仓库名称下,点击 议题。

-
打开您想要指派给 Copilot 的 Issue。
-
在右侧菜单中,点击 Assignees(受理人)。

-
在受理人列表中点击 Copilot。

会显示更多选项。

-
在 Optional prompt(可选提示)字段中,您可以为 Copilot 添加特定的指示。加入任何上下文、约束或特定需求,以帮助 Copilot 理解并完成任务。
例如,您可以说明要使用的特定编码模式或框架、测试要求、代码风格偏好、哪些文件或目录应当或不应当被修改等。
除您在此处提供的细节外,Copilot 还会使用针对目标仓库已配置的自定义指令。请参阅 为 GitHub Copilot 添加仓库自定义指令。
-
您可以在对话框的下拉菜单中更改 Copilot 将要工作的仓库以及它将分支自哪个分支。
所有您拥有至少读取权限的仓库都会显示在仓库下拉菜单中。但仅当您拥有写入权限且该仓库已启用 Copilot 云代理时,才能选择该仓库。
如果您选择的仓库所属组织与 Issue 所在组织不同,或在 Issue 位于私有仓库时选择了公共仓库,系统会显示警告。
如未指定仓库,Copilot 将在 Issue 所在的同一仓库中工作;如未指定分支,Copilot 将基于选定仓库的默认分支进行工作。
提示
当您将 Issue 指派给 Copilot 时,Copilot 会收到 Issue 标题、描述、当前所有评论以及您提供的任何额外指令。指派后,Copilot 不会感知随后添加的评论,也不会对此作出响应。如有更多信息或对原需求的更改,请在 Copilot 发起的拉取请求中以评论形式补充。
-
可选地,您可以点击打开代理下拉菜单,以指派带有特化行为和工具的代理或自定义代理。您可以从仓库、组织或企业中选择已有的自定义代理,也可以点击 创建代理,在所选仓库和分支上创建新的代理配置文件。更多信息请参阅 为 Copilot 云代理创建自定义代理。
注意
第三方编码代理仅在 GitHub Copilot Pro+ 与 Copilot Enterprise 计划中可用。
-
如果您是 GitHub Copilot Pro 或 GitHub Copilot Pro+ 用户,可在下拉菜单中选择 Copilot 将要使用的模型。详情请见 更改 GitHub Copilot 云代理的 AI 模型
您还可以在 GitHub.com 的其他位置将 Issue 指派给 Copilot
- 在仓库的 Issues 页面上的 Issue 列表中。
- 在 GitHub Projects 中查看 Issue 时。
在 GitHub Mobile 上将 Issue 指派给 Copilot
- 在 GitHub Mobile 中,导航至包含您想要指派给 Copilot 的 Issue 的仓库。
- 点击 Issues。
- 打开您想要指派给 Copilot 的 Issue。
- 点击 图标。
- 在 “Assignees”(受理人)旁,点击 Edit(编辑)。
- 在 “Copilot” 旁,点击加号。
- 点击 Done(完成)。
通过 GitHub API 将 Issue 指派给 Copilot
注意
此功能处于公开预览阶段,可能会有所变动。
您可以使用 GraphQL API 或 REST API 将 Issue 指派给 Copilot,两者都支持可选的 Agent Assignment(代理指派)输入,以自定义任务。
| GraphQL 参数 | REST 参数 | 描述 |
|---|---|---|
targetRepositoryId | target_repo | Copilot 将要工作的仓库 |
baseRef | base_branch | Copilot 将从该分支创建新分支 |
customInstructions | custom_instructions | Copilot 的附加指令 |
customAgent | custom_agent | 用于该任务的自定义代理 |
model | model | Copilot 使用的模型 |
使用 GraphQL API
注意
您必须在请求头中添加 GraphQL-Features,值为 issues_copilot_assignment_api_support 与 coding_agent_model_selection。
以下 GraphQL 变更可用于将 Issue 指派给 Copilot
创建并指派新 Issue
-
请确保使用用户令牌(如个人访问令牌或 GitHub App 的用户‑到‑服务器令牌)进行 API 认证。
注意
若使用细粒度个人访问令牌,需要具备以下权限才能指派 Copilot 处理 Issue:
- 读取元数据的权限
- 对 actions、contents、issues 和 pull requests 的读取和写入权限
若使用传统(classic)个人访问令牌,则需拥有
repo范围权限。 -
通过查询仓库的 GraphQL
suggestedActors字段,确认该仓库已启用 Copilot 云代理。将octo-org替换为仓库所有者,octo-repo替换为仓库名称。GraphQL query { repository(owner: "octo-org", name: "octo-repo") { suggestedActors(capabilities: [CAN_BE_ASSIGNED], first: 100) { nodes { login __typename ... on Bot { id } ... on User { id } } } } }query { repository(owner: "octo-org", name: "octo-repo") { suggestedActors(capabilities: [CAN_BE_ASSIGNED], first: 100) { nodes { login __typename ... on Bot { id } ... on User { id } } } } }如果用户和仓库均已启用 Copilot 云代理,查询返回的第一个节点的
login值将为copilot-swe-agent。 -
记录该登录的
id值。 -
获取您想要创建 Issue 的仓库的 GraphQL 全局 ID,同样将
octo-org替换为所有者,octo-repo替换为仓库名。GraphQL query { repository(owner: "octo-org", name: "octo-repo") { id } }query { repository(owner: "octo-org", name: "octo-repo") { id } } -
使用
createIssue变更创建 Issue。将REPOSITORY_ID替换为上一步返回的 ID,将BOT_ID替换为之前记录的 ID。您可以选填agentAssignment输入以自定义任务。Shell gh api graphql -f query='mutation { createIssue(input: { repositoryId: "REPOSITORY_ID", title: "Implement comprehensive unit tests", body: "DETAILS", assigneeIds: ["BOT_ID"], agentAssignment: { targetRepositoryId: "REPOSITORY_ID", baseRef: "main", customInstructions: "Add comprehensive test coverage", customAgent: "", model: "" } }) { issue { id title assignees(first: 10) { nodes { login } } } } }' -H 'GraphQL-Features: issues_copilot_assignment_api_support,coding_agent_model_selection'gh api graphql -f query='mutation { createIssue(input: { repositoryId: "REPOSITORY_ID", title: "Implement comprehensive unit tests", body: "DETAILS", assigneeIds: ["BOT_ID"], agentAssignment: { targetRepositoryId: "REPOSITORY_ID", baseRef: "main", customInstructions: "Add comprehensive test coverage", customAgent: "", model: "" } }) { issue { id title assignees(first: 10) { nodes { login } } } } }' -H 'GraphQL-Features: issues_copilot_assignment_api_support,coding_agent_model_selection'
指派已有 Issue
-
请确保使用用户令牌(如个人访问令牌或 GitHub App 的用户‑到‑服务器令牌)进行 API 认证。
-
通过查询仓库的 GraphQL
suggestedActors字段,确认该仓库已启用 Copilot 云代理。将octo-org替换为仓库所有者,octo-repo替换为仓库名称。GraphQL query { repository(owner: "monalisa", name: "octocat") { suggestedActors(capabilities: [CAN_BE_ASSIGNED], first: 100) { nodes { login __typename ... on Bot { id } ... on User { id } } } } }query { repository(owner: "monalisa", name: "octocat") { suggestedActors(capabilities: [CAN_BE_ASSIGNED], first: 100) { nodes { login __typename ... on Bot { id } ... on User { id } } } } }如果用户和仓库均已启用 Copilot 云代理,查询返回的第一个节点的
login值将为copilot-swe-agent。 -
获取您想要指派给 Copilot 的 Issue 的 GraphQL 全局 ID,将
monalisa替换为仓库所有者,octocat替换为仓库名,9000替换为 Issue 编号。GraphQL query { repository(owner: "monalisa", name: "octocat") { issue(number: 9000) { id title } } }query { repository(owner: "monalisa", name: "octocat") { issue(number: 9000) { id title } } } -
使用
replaceActorsForAssignable变更将已有 Issue 指派给 Copilot。将ISSUE_ID替换为上一步返回的 ID,BOT_ID替换为之前的 Bot ID,REPOSITORY_ID替换为仓库 ID。同样可以选填agentAssignment输入以自定义任务。Shell gh api graphql -f query='mutation { replaceActorsForAssignable(input: { assignableId: "ISSUE_ID", actorIds: ["BOT_ID"], agentAssignment: { targetRepositoryId: "REPOSITORY_ID", baseRef: "main", customInstructions: "Fix the reported bug", customAgent: "", model: "" } }) { assignable { ... on Issue { id title assignees(first: 10) { nodes { login } } } } } }' -H 'GraphQL-Features: issues_copilot_assignment_api_support,coding_agent_model_selection'gh api graphql -f query='mutation { replaceActorsForAssignable(input: { assignableId: "ISSUE_ID", actorIds: ["BOT_ID"], agentAssignment: { targetRepositoryId: "REPOSITORY_ID", baseRef: "main", customInstructions: "Fix the reported bug", customAgent: "", model: "" } }) { assignable { ... on Issue { id title assignees(first: 10) { nodes { login } } } } } }' -H 'GraphQL-Features: issues_copilot_assignment_api_support,coding_agent_model_selection' -
或者,您可以使用
updateIssue变更来更新已有 Issue 并指派给 Copilot。将ISSUE_ID替换为 Issue ID,将BOT_ID替换为 Bot ID。Shell gh api graphql -f query='mutation { updateIssue(input: { id: "ISSUE_ID", assigneeIds: ["BOT_ID"], agentAssignment: { targetRepositoryId: "REPOSITORY_ID", baseRef: "main", customInstructions: "Update feature implementation", customAgent: "", model: "" } }) { issue { id title assignees(first: 10) { nodes { login } } } } }' -H 'GraphQL-Features: issues_copilot_assignment_api_support,coding_agent_model_selection'gh api graphql -f query='mutation { updateIssue(input: { id: "ISSUE_ID", assigneeIds: ["BOT_ID"], agentAssignment: { targetRepositoryId: "REPOSITORY_ID", baseRef: "main", customInstructions: "Update feature implementation", customAgent: "", model: "" } }) { issue { id title assignees(first: 10) { nodes { login } } } } }' -H 'GraphQL-Features: issues_copilot_assignment_api_support,coding_agent_model_selection' -
您也可以使用
addAssigneesToAssignable变更在保留其他受理人的同时为已有 Issue 添加 Copilot。将ISSUE_ID替换为 Issue ID,将BOT_ID替换为 Bot ID。Shell gh api graphql -f query='mutation { addAssigneesToAssignable(input: { assignableId: "ISSUE_ID", assigneeIds: ["BOT_ID"], agentAssignment: { targetRepositoryId: "REPOSITORY_ID", baseRef: "main", customInstructions: "Collaborate on this task", customAgent: "", model: "" } }) { assignable { ... on Issue { id title assignees(first: 10) { nodes { login } } } } } }' -H 'GraphQL-Features: issues_copilot_assignment_api_support,coding_agent_model_selection'gh api graphql -f query='mutation { addAssigneesToAssignable(input: { assignableId: "ISSUE_ID", assigneeIds: ["BOT_ID"], agentAssignment: { targetRepositoryId: "REPOSITORY_ID", baseRef: "main", customInstructions: "Collaborate on this task", customAgent: "", model: "" } }) { assignable { ... on Issue { id title assignees(first: 10) { nodes { login } } } } } }' -H 'GraphQL-Features: issues_copilot_assignment_api_support,coding_agent_model_selection'
使用 REST API
以下 REST API 端点可用于将 Issue 指派给 Copilot
向已有 Issue 添加受理人
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/OWNER/REPO/issues/ISSUE_NUMBER/assignees \
--input - <<< '{
"assignees": ["copilot-swe-agent[bot]"],
"agent_assignment": {
"target_repo": "OWNER/REPO",
"base_branch": "main",
"custom_instructions": "",
"custom_agent": "",
"model": ""
}
}'
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/OWNER/REPO/issues/ISSUE_NUMBER/assignees \
--input - <<< '{
"assignees": ["copilot-swe-agent[bot]"],
"agent_assignment": {
"target_repo": "OWNER/REPO",
"base_branch": "main",
"custom_instructions": "",
"custom_agent": "",
"model": ""
}
}'
创建新 Issue
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/OWNER/REPO/issues \
--input - <<< '{
"title": "Issue title",
"body": "Issue description.",
"assignees": ["copilot-swe-agent[bot]"],
"agent_assignment": {
"target_repo": "OWNER/REPO",
"base_branch": "main",
"custom_instructions": "",
"custom_agent": "",
"model": ""
}
}'
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/OWNER/REPO/issues \
--input - <<< '{
"title": "Issue title",
"body": "Issue description.",
"assignees": ["copilot-swe-agent[bot]"],
"agent_assignment": {
"target_repo": "OWNER/REPO",
"base_branch": "main",
"custom_instructions": "",
"custom_agent": "",
"model": ""
}
}'
更新已有 Issue
gh api \
--method PATCH \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/OWNER/REPO/issues/ISSUE_NUMBER \
--input - <<< '{
"assignees": ["copilot-swe-agent[bot]"],
"agent_assignment": {
"target_repo": "OWNER/REPO",
"base_branch": "main",
"custom_instructions": "",
"custom_agent": "",
"model": ""
}
}'
gh api \
--method PATCH \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/OWNER/REPO/issues/ISSUE_NUMBER \
--input - <<< '{
"assignees": ["copilot-swe-agent[bot]"],
"agent_assignment": {
"target_repo": "OWNER/REPO",
"base_branch": "main",
"custom_instructions": "",
"custom_agent": "",
"model": ""
}
}'
从 Raycast 将 Issue 指派给 Copilot
Raycast 是一款适用于 Windows 与 macOS 的可扩展启动器。使用 Raycast 的 GitHub Copilot 扩展,您可以启动并跟踪 Copilot 云代理任务,并随时实时查看会话日志。
-
在 Raycast 官方网站下载安装 Raycast。
-
通过点击 Install Extension(安装扩展)按钮,安装 GitHub Copilot 的 Raycast 扩展。
-
打开 Raycast,搜索 “Copilot”,找到 Assign Issues to Copilot(指派 Issue 给 Copilot)命令,然后按 Enter。
-
点击 Sign in with GitHub(使用 GitHub 登录),完成身份验证流程。Raycast 将重新打开。
-
选择您希望 Copilot 工作的仓库。
-
选择您想要指派给 Copilot 的 Issue。
-
可选地,选择 Copilot 拉取请求的基准分支。Copilot 将基于此分支创建新分支,然后将更改推送至针对该分支的拉取请求。
-
可选地,从下拉菜单中选择具有特化行为和工具的自定义代理。详情请参阅 为 Copilot 云代理创建自定义代理。
-
如果您是 GitHub Copilot Pro 或 GitHub Copilot Pro+ 用户,可在下拉菜单中选择 Copilot 将要使用的模型。详情请见 更改 GitHub Copilot 云代理的 AI 模型
-
可选地,提供附加指令。这些指令将与 Issue 内容一起传递给 Copilot。
-
按 Command+Enter(macOS)或 Ctrl+Enter(Windows)以指派 Issue。
Copilot 将启动新会话,处理任务并将更改推送至其拉取请求,完成后会将您添加为审阅者并触发通知。
注意
如果您无法在启动任务时选择特定仓库,可能是组织对 OAuth 应用访问设置了限制。了解如何为 “GitHub Copilot for Raycast” OAuth 应用请求批准,请参阅 请求组织对 OAuth 应用的批准。
从代理选项卡或面板请求 Copilot 创建拉取请求
您可以在代理选项卡或代理面板中请求 Copilot 打开拉取请求。唯一的区别是入口点——一旦看到 “New agent task”(新建代理任务)表单,后续步骤相同。
-
打开代理面板或选项卡
- 打开仓库中的 Agents 选项卡。
- 导航至代理页面:打开 github.com/copilot/agents。您也可以通过打开代理面板后点击 View all(查看全部)进入。
- 打开代理面板:点击位于 GitHub 右上角导航栏的图标。
-
在提示框的下拉菜单中,选择您希望 Copilot 工作的仓库。
-
输入描述您请求的提示。您也可以通过粘贴、拖拽或上传图片的方式添加截图或 UI 原型等视觉输入。支持的文件类型:image/png、image/jpeg、image/gif、image/webp。
例如,
Create a pull request to implement a user friendly message for common errors. -
可选地,选择 Copilot 拉取请求的基准分支。Copilot 将基于此分支创建新分支,然后将更改推送至针对该分支的拉取请求。
-
可选地,您可以点击打开代理下拉菜单,以指派带有特化行为和工具的代理或自定义代理。您可以从仓库、组织或企业中选择已有的自定义代理,也可以点击 创建代理,在所选仓库和分支上创建新的代理配置文件。更多信息请参阅 为 Copilot 云代理创建自定义代理。
注意
第三方编码代理仅在 GitHub Copilot Pro+ 与 Copilot Enterprise 计划中可用。
-
如果您是 GitHub Copilot Pro 或 GitHub Copilot Pro+ 用户,可在下拉菜单中选择 Copilot 将要使用的模型。详情请见 更改 GitHub Copilot 云代理的 AI 模型
-
点击 或按 Enter。
Copilot 将启动新会话,该会话会显示在提示框下方的列表中。Copilot 将处理任务并将更改推送至其拉取请求,完成后会将您添加为审阅者并触发通知。
从仪表盘请求 Copilot 创建拉取请求
您可以在仪表盘的 Copilot 提示框中请求 Copilot 打开拉取请求。仪表盘是您登录后访问 https://github.com 时看到的个人化活动概览。
-
在 https://github.com 打开仪表盘。
-
点击 Task 按钮。
-
在提示框的下拉菜单中,选择您希望 Copilot 工作的仓库。
-
输入描述您请求的提示。
例如,
Create a pull request to implement a user friendly message for common errors. -
可选地,选择 Copilot 拉取请求的基准分支。Copilot 将基于此分支创建新分支,并将更改推送至对应的拉取请求。
-
可选地,您可以点击打开代理下拉菜单,以指派带有特化行为和工具的代理或自定义代理。您可以从仓库、组织或企业中选择已有的自定义代理,也可以点击 创建代理,在所选仓库和分支上创建新的代理配置文件。更多信息请参阅 为 Copilot 云代理创建自定义代理。
注意
第三方编码代理仅在 GitHub Copilot Pro+ 与 Copilot Enterprise 计划中可用。
-
点击 Send now 或按 Return。
系统会跳转至代理选项卡,Copilot 将启动新会话并在提示框下方的 “Recent sessions”(近期会话) 列表中显示。Copilot 会处理任务并将更改推送至其拉取请求,完成后会把您加入审阅者并触发通知。
注意
如果您在功能预览中启用了 New Dashboard Experience(新仪表盘体验),新会话将出现在仪表盘提示框下方的 “Agent sessions”(代理会话) 区域。更多信息请参见 个人仪表盘。
在 Visual Studio Code 的 Copilot Chat 中请求 Copilot 创建拉取请求
-
为 Visual Studio Code 安装 GitHub Pull Requests 扩展。
-
在 Visual Studio Code 中打开 GitHub Copilot Chat。
-
输入说明您希望 Copilot 执行的任务的提示。
例如,
Put backticks around file names and variables in output提示
为帮助 Copilot,您可在提交提示前选中相关代码行。
-
点击以下按钮提交提示: Delegate this task to the GitHub Copilot cloud agent(将此任务委托给 GitHub Copilot 云代理)按钮,位于 Send(发送)按钮旁
-
如果您有本地更改,系统会弹出对话,询问是否要推送这些更改以让 Copilot 从当前状态开始工作。点击 Include changes(包含更改)以推送,或点击 Ignore changes(忽略更改)让 Copilot 从仓库默认分支开始。
Copilot 将启动新会话并返回其创建的拉取请求链接。它会处理任务并推送更改至该拉取请求,完成后会将您添加为审阅者并触发通知。
在 JetBrains IDE 的 Copilot Chat 中请求 Copilot 创建拉取请求
注意
JetBrains IDE 中的 Copilot 云代理处于公开预览阶段,可能会有变动。
-
在您的 JetBrains IDE 中打开 GitHub Copilot Chat。
-
输入说明您希望 Copilot 执行的任务的提示。
例如,
Put backticks around file names and variables in output -
点击 Delegate to Cloud Agent(委托至云代理)按钮,位于 Send(发送)按钮旁。
Copilot 将启动新会话并返回其创建的拉取请求链接。它会处理任务并推送更改至该拉取请求,完成后会将您添加为审阅者并在 GitHub 与 IDE 中触发通知。
在 Eclipse 的 Copilot Chat 中请求 Copilot 创建拉取请求
注意
Eclipse 中的 Copilot 云代理处于公开预览阶段,可能会有变动。
-
在 Eclipse 中打开 GitHub Copilot Chat。
-
输入说明您希望 Copilot 执行的任务的提示。
例如,
Put backticks around file names and variables in output -
点击 按钮,位于 Send(发送)按钮旁。
-
在弹出的对话框中选择 Copilot 将要工作的仓库,然后点击 Continue(继续)。
Copilot 将启动新会话并返回其创建的拉取请求链接。它会处理任务并推送更改至该拉取请求,完成后会将您添加为审阅者并在 GitHub 与 IDE 中触发通知。
在 Visual Studio 2026 的 Copilot Chat 中请求 Copilot 创建拉取请求
注意
要在 Visual Studio 中使用 Copilot 云代理,您需至少运行 2026 版 18.1.0(December Update) 及以上版本。
-
在 Visual Studio 中启用 Copilot 云代理支持。
- 打开 Tools(工具)菜单,选择 Options(选项)。
- 在侧边栏中选择 GitHub。
- 勾选 Enable Copilot Cloud agent (preview)(启用 Copilot 云代理(预览))复选框。
- 重启 Visual Studio。
-
在 Visual Studio 中打开 GitHub Copilot Chat。
-
输入提示,说明您希望 Copilot 做哪些更改。
例如,
Put backticks around file names and variables in log output. -
点击以下按钮提交提示: Delegate this task to the GitHub Copilot cloud agent(将此任务委托给 GitHub Copilot 云代理)按钮,位于 点击 Send(发送)按钮。
Copilot 会询问您是否确认使用云代理创建拉取请求。
-
点击 Confirm(确认)。
Copilot 将启动新会话并返回其创建的拉取请求链接。它会处理任务并推送更改至该拉取请求,完成后会将您添加为审阅者并触发通知。
在 GitHub.com 的 Copilot Chat 中请求 Copilot 创建拉取请求
-
打开 GitHub.com 上的 GitHub Copilot Chat。
-
输入
/task来请求 Copilot 创建拉取请求,并说明您希望 Copilot 更改的内容。例如,
/task Create a pull request to put backticks around file names and variables in output. -
可选地,选择 Copilot 拉取请求的基准分支。Copilot 将基于此分支创建新分支,然后将更改推送至针对该分支的拉取请求。
-
可选地,您可以点击打开代理下拉菜单,以指派带有特化行为和工具的代理或自定义代理。您可以从仓库、组织或企业中选择已有的自定义代理,也可以点击 创建代理,在所选仓库和分支上创建新的代理配置文件。更多信息请参阅 为 Copilot 云代理创建自定义代理。
注意
第三方编码代理仅在 GitHub Copilot Pro+ 与 Copilot Enterprise 计划中可用。
-
点击 或按 Enter。
Copilot 将启动新会话,该会话会显示在提示框下方的列表中。Copilot 将处理任务并将更改推送至其拉取请求,完成后会将您添加为审阅者并触发通知。
在 GitHub Mobile 中请求 Copilot 创建拉取请求
-
在 GitHub Mobile 中,导航至您想要创建拉取请求的仓库。
-
点击屏幕右下角的 图标,位于屏幕右下角。
-
输入提示,要求 Copilot 创建拉取请求。
例如:
Create a pull request to ...。Copilot 会返回任务的简要概述并请求您确认后再继续。
-
确认 Copilot 正确理解了您的提示后,点击 Accept(接受)或 Dismiss(取消)。
Copilot 会创建拉取请求并提供链接。它会处理任务并将更改推送至该拉取请求,完成后会把您加入审阅者并触发通知。
在 GitHub CLI 中请求 Copilot 创建拉取请求
注意
agent-task 命令集仅在 GitHub CLI 版本 v2.80.0 及以上可用。此命令集为公开预览,可能会有变动。
您可以使用 gh agent-task create 命令在 GitHub CLI 中启动新的 Copilot 云代理会话。
运行该命令而不提供参数时,系统会提示您输入提示。Copilot 云代理会根据提示在当前仓库中打开拉取请求。
您可以使用命令行选项来
- 提供提示(
gh agent-task create "示例提示") - 选择一个基础分支,而不是使用仓库的默认分支(
--base) - 选择一个仓库,而不是针对当前仓库(
--repo) - 实时跟踪会话日志(
--follow)
要查看所有可用选项,请运行 gh agent-task create --help。
从 GitHub MCP 服务器请求 Copilot 创建拉取请求
注意
- 此功能仅在远程 GitHub MCP 服务器以及支持远程 MCP 服务器的宿主应用中可用。
-
在您喜欢的 IDE 或代理编码工具中安装 GitHub MCP 服务器。请参阅 在 IDE 中使用 GitHub MCP 服务器。
-
确保已启用
create_pull_request_with_copilot工具。 -
打开聊天。
-
输入一个提示,要求 Copilot 创建拉取请求,并说明您想更改的细节。
例如,
在我的仓库中打开一个 PR,以扩大单元测试覆盖率。提示
- 您可以在提示中包含特定分支,以让 Copilot 使用该分支作为基础分支来打开拉取请求。
-
提交您的提示。
Copilot 将启动一个新会话,打开一个草稿拉取请求并在后台执行任务。执行过程中,它会将更改推送到拉取请求,完成后会将您添加为审阅者。大多数情况下,MCP 主机会显示已创建拉取请求的 URL。
从 Raycast 请求 Copilot 创建拉取请求
Raycast 是一款适用于 Windows 与 macOS 的可扩展启动器。使用 Raycast 的 GitHub Copilot 扩展,您可以启动并跟踪 Copilot 云代理任务,并随时实时查看会话日志。
-
在 Raycast 官方网站下载安装 Raycast。
-
通过点击 Install Extension(安装扩展)按钮,安装 GitHub Copilot 的 Raycast 扩展。
-
打开 Raycast,搜索 “Copilot”,找到 创建任务 命令,然后按 Enter。
-
点击 Sign in with GitHub(使用 GitHub 登录),完成身份验证流程。Raycast 将重新打开。
-
输入一个描述您希望 Copilot 执行操作的提示。
例如,
实现对常见错误的友好提示信息。 -
选择您希望 Copilot 工作的仓库。
-
可选地,选择 Copilot 拉取请求的基准分支。Copilot 将基于此分支创建新分支,然后将更改推送至针对该分支的拉取请求。
-
可选地,从下拉菜单中选择具有特化行为和工具的自定义代理。详情请参阅 为 Copilot 云代理创建自定义代理。
-
如果您是 GitHub Copilot Pro 或 GitHub Copilot Pro+ 用户,可在下拉菜单中选择 Copilot 将要使用的模型。详情请见 更改 GitHub Copilot 云代理的 AI 模型
-
按 Command+Enter(macOS)或 Ctrl+Enter(Windows)以开始任务。
Copilot 将启动新会话,处理任务并将更改推送至其拉取请求,完成后会将您添加为审阅者并触发通知。
注意
如果您无法在启动任务时选择特定仓库,可能是组织对 OAuth 应用访问设置了限制。了解如何为 “GitHub Copilot for Raycast” OAuth 应用请求批准,请参阅 请求组织对 OAuth 应用的批准。
从 “新建仓库” 页面请求 Copilot 创建拉取请求
创建新仓库时,您可以通过输入提示来让 Copilot 为新仓库提供初始内容。
-
在任意页面的右上角,选择,然后点击 新建仓库。

-
使用 Owner(所有者)下拉菜单选择您希望拥有该仓库的账户。

-
在 提示 字段中,输入描述您希望 Copilot 构建内容的提示。
例如,
创建一个 Rust CLI,用于将 CSV 表格转换为 Markdown -
点击 创建仓库。
Copilot 会立即打开一个草稿拉取请求。它会执行任务并将更改推送到该拉取请求,完成后会将您添加为审阅者,并触发通知。
监控进度
您可以在代理面板、agents 页面、Visual Studio Code 等处查看当前和过去的 Copilot 会话。请参阅 跟踪 GitHub Copilot 会话。