注意
如需查看 Copilot云代理 的概述,请参阅 关于 GitHub Copilot 云代理。
Introduction
可以从此处开始 Copilot云代理。
-
GitHub Issues,通过将问题分配给Copilot
-
上的 “代理”选项卡或面板 -
副驾驶聊天 in Visual Studio Code、 JetBrains IDE、 Eclipse 和 Visual Studio 2026
-
副驾驶聊天 上的 GitHub.com
-
具有 模型上下文协议(MCP) 支持的首选 IDE 或代理编码工具
-
Raycast 启动器
-
Copilot 将在后台开始处理任务。 某些入口会自动打开拉取请求。 在其他情况下,可以从会话日志中提示 Copilot 打开拉取请求,或者在完成工作时创建拉取请求 Copilot 。
有关详细信息,请参阅“关于 GitHub Copilot 云代理”。
将问题分配给 Copilot
可以请求 Copilot 将问题分配给 Copilot 来开始处理问题。
Copilot 将开始处理任务,发起拉取请求,然后在完成工作的时候请求您的评审。
可以将问题分配给 Copilot:
- 关于 GitHub.com (请参阅 下一部分)
- 打开 GitHub Mobile
- 通过 GitHub API(请参阅本文后面的部分)
- 使用 Raycast 启动器
- 使用 GitHub CLI (请参阅
gh issue edit)
将问题 Copilot 分配到 GitHub.com
注意
此功能目前处于公共预览版,可能会发生更改。
-
在 GitHub 上,导航到存储库的主页面。
-
在仓库名称下,单击 “Issues”****。

-
打开要分配给 Copilot 的问题。
-
在右侧菜单中,单击“代理人”****。

-
从被分配者列表中单击Copilot。

此时,将显示其他选项。

-
在 “可选提示 ”字段中,可以添加特定 Copilot指南。 添加有助于理解和完成任务的任何上下文、约束或特定要求 Copilot 。
例如,可以包含有关要使用的特定编码模式或框架、测试要求、代码样式偏好设置、应修改或不应修改的文件或目录的说明。
除了在此处提供的详细信息之外, Copilot 还将使用为目标存储库配置的任何自定义说明。 请参阅“为GitHub Copilot添加存储库自定义说明”。
-
可以使用对话框中的下拉菜单更改 Copilot 将要工作的存储库,以及它将从中派生的分支。
所有您拥有至少读取权限的存储库都会显示在存储库下拉菜单中。 但是,只有在您对该存储库具有写入访问权限并且Copilot云代理已为该存储库启用时,您才能选择该存储库。
如果在与问题源组织不同的组织中选择存储库,或者在问题位于专用存储库中时选择公共存储库,则会显示警告。
如果未指定存储库, Copilot 则会在与问题相同的存储库中工作。 如果未指定分支, Copilot 则从所选存储库的默认分支工作。
提示
当将问题分配给 Copilot 时,它会收到问题标题、描述、当前存在的任何注释以及你提供的任何其他说明。 分配问题后, Copilot 将不知道,因此不会对添加到问题的任何进一步注释做出反应。 如果您掌握了更多信息,或对原始要求进行了更改,请将这些内容作为注释添加到 Copilot 提出的拉取请求中。
-
(可选)如果您想分配一个代理或一个具有专用行为和工具的,可以单击自定义智能体以打开代理下拉菜单。 可以从存储库、组织或企业中选择现有 自定义智能体。 还可以单击“创建代理”,在所选存储库和分支中创建新的代理资料代理。 有关详细信息,请参阅“为Copilot云代理创建自定义代理”。
注意
第三方代理可用于 GitHub Copilot Pro、GitHub Copilot Pro+、GitHub Copilot业务 和 GitHub Copilot Enterprise 计划。
-
(可选)可以使用下拉菜单来选择将使用的 Copilot 模型。 有关详细信息,请参阅“更改 GitHub Copilot 云代理的 AI 模型”。
还可以从Copilot上的其他位置将问题分配给GitHub.com。
- 从存储库 的“问题 ”页上的问题列表中。
- 查看问题 GitHub项目时。
将问题 Copilot 分配到 GitHub Mobile
- 在 GitHub Mobile中,导航到包含要分配给 Copilot的问题的存储库。
- 单击“ 问题”。
- 打开要分配给 Copilot 的问题。
- 点击**** 图标。
- 在“分配者”旁边,点击 “编辑”。
- 在“”Copilot旁边,单击加号。
- 单击完成。
通过 Copilot API 将问题分配给 GitHub
注意
此功能目前处于公共预览版,可能会发生更改。
可以使用 GraphQL API 或 REST API 将问题分配给 Copilot。 这两个 API 都支持可选的代理任务分配输入来定制任务:
| 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 变更操作将问题分配给 Copilot:
创建和分配新议题
-
请确保使用用户令牌(例如 personal access token ,或 GitHub App 用户到服务器令牌)通过 API 进行身份验证。
注意
如果使用fine-grained personal access token,则需要以下权限才能将Copilot分配给一个问题:
- 对元数据的读取访问权限
- 对操作、内容、议题和拉取请求的读写访问权限
如果使用personal access token (classic),则需要
repo范围来将Copilot分配到一个问题中。 -
通过检查 GraphQL API 中存储库的 Copilot云代理 是否包含
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值。 -
获取你想要在其中创建议题的仓库的 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突变创建议题。 将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'
分配现有议题
-
请确保使用用户令牌(例如 personal access token ,或 GitHub App 用户到服务器令牌)通过 API 进行身份验证。
-
通过检查 GraphQL API 中存储库的 Copilot云代理 是否包含
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的问题的 GraphQL 全局 ID,将其
monalisa替换为存储库所有者、octocat名称和9000问题编号。GraphQL query { repository(owner: "monalisa", name: "octocat") { issue(number: 9000) { id title } } }query { repository(owner: "monalisa", name: "octocat") { issue(number: 9000) { id title } } } -
将现有问题分配给 Copilot 使用
replaceActorsForAssignable突变。 将ISSUE_ID替换为上一步返回的 ID,将BOT_ID替换为前面步骤返回的 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变更来更新现有问题并将其分配给 Copilot。 将ISSUE_ID替换为问题 ID,将BOT_ID替换为机器人 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变更将 Copilot 添加到现有问题中,同时保留其他被分配者。 将ISSUE_ID替换为问题 ID,将BOT_ID替换为机器人 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 终结点将问题分配给 Copilot:
向现有问题添加被分配者
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": ""
}
}'
创建新问题
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": ""
}
}'
更新现有问题
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": ""
}
}'
将问题分配给 Copilot 从 Raycast
Raycast 是适用于 Windows 和 macOS 的可扩展启动器。 GitHub Copilot使用 Raycast 的扩展,您可以在您的计算机上随时随地启动和跟踪Copilot云代理任务,并实时观看会话日志。
-
从 Raycast 网站安装 Raycast。
-
GitHub Copilot单击**扩展页上的**“[安装扩展](https://www.raycast.com/github/github-copilot)”按钮,安装 Raycast 的扩展。 -
打开 Raycast,搜索“Copilot”,找到命令分配问题给Copilot,然后按Enter。
-
单击 使用 GitHub 登录,然后完成身份验证流程。 Raycast 将重新打开。
-
选择要在其中工作的存储库 Copilot 。
-
选择要分配给 Copilot 的问题。
-
可选地为 Copilot 的拉取请求选择一个基分支。 Copilot 将基于此分支创建新分支,然后将更改推送到面向该分支的拉取请求。
-
(可选)从下拉菜单中选择具有专用行为和工具的 自定义智能体。 有关详细信息,请参阅“为Copilot云代理创建自定义代理”。
-
(可选)可以使用下拉菜单来选择将使用的 Copilot 模型。 有关详细信息,请参阅“更改 GitHub Copilot 云代理的 AI 模型”。
-
(可选)提供其他说明。 这些内容将与你的问题内容一起传递给 Copilot。
-
按Command+Enter(macOS)或Ctrl+Enter(Windows)指派任务。
Copilot 将启动新会话。 Copilot 将处理任务并将更改推送到其拉取请求中,任务完成后,它会将你添加为审阅者,并触发通知。
注意
如果在启动任务时无法选择特定存储库,则拥有该存储库的组织可能已启用 OAuth app 访问限制。 要了解如何请求批准“GitHub Copilot for Raycast” OAuth app,请参阅 请求组织批准 OAuth 应用。
Copilot要求从“代理”选项卡或面板开始工作
可以从“代理”选项卡和“代理”面板询问启动会话。 唯一的区别是入口点 - 看到“New agent task”窗体后,步骤是相同的。
-
打开代理面板或选项卡:
- 在存储库中打开 Agents 选项卡。
- 导航到智能体页面****:转到 github.com/copilot/agents。 你也可以通过打开智能体面板,然后单击“View all”进入此页面****。
- 打开智能体面板****:单击 GitHub 右上角导航栏中的 。
-
使用提示字段中的下拉菜单,选择要使用的存储库 Copilot 。
-
键入描述请求的提示。 还可以通过粘贴、拖动或上传图像来添加视觉输入,例如屏幕截图或 UI 模型。 支持的文件:image/png、image/jpeg、image/gif、image/webp。
例如:
Implement a user friendly message for common errors.如果要 Copilot 打开拉取请求,可以在提示中提问,例如
Open a pull request to implement a user friendly message for common errors. -
(可选)为 Copilot 的变更选择基分支。 Copilot 将基于此分支创建新分支。
-
(可选)如果您想分配一个代理或一个具有专用行为和工具的,可以单击自定义智能体以打开代理下拉菜单。 可以从存储库、组织或企业中选择现有 自定义智能体。 还可以单击“创建代理”,在所选存储库和分支中创建新的代理资料代理。 有关详细信息,请参阅“为Copilot云代理创建自定义代理”。
注意
第三方代理可用于 GitHub Copilot Pro、GitHub Copilot Pro+、GitHub Copilot业务 和 GitHub Copilot Enterprise 计划。
-
(可选)可以使用下拉菜单来选择将使用的 Copilot 模型。 有关详细信息,请参阅“更改 GitHub Copilot 云代理的 AI 模型”。
-
单击 或按 Enter。
Copilot 将启动一个新会话,该会话将显示在提示框下面的列表中。 Copilot 将处理任务并推送任何代码更改。在会话日志中,只需单击一次即可追踪 Copilot的工作并打开拉取请求。 有关详细信息,请参阅“跟踪 GitHub Copilot 的会话”。
要求Copilot从仪表板开始工作
你可以要求 Copilot 从 Copilot 仪表板中的提示框打开拉取请求。 仪表板是你在登录时访问 GitHub 时看到的 https://github.com 上活动的个性化概述。
-
导航到 https://github.com 的仪表板。
-
** <svg version="1.1" width="16" height="16" viewBox="0 0 16 16" class="octicon octicon-agent" aria-label="The Agents icon" role="img"><path d="M14.5 8.9v-.052A2.956 2.956 0 0 0 11.542 5.9a.815.815 0 0 1-.751-.501l-.145-.348A3.496 3.496 0 0 0 7.421 2.9h-.206a3.754 3.754 0 0 0-3.736 4.118l.011.121a.822.822 0 0 1-.619.879A1.81 1.81 0 0 0 1.5 9.773v.14c0 1.097.89 1.987 1.987 1.987H4.5a.75.75 0 0 1 0 1.5H3.487A3.487 3.487 0 0 1 0 9.913v-.14C0 8.449.785 7.274 1.963 6.75A5.253 5.253 0 0 1 7.215 1.4h.206a4.992 4.992 0 0 1 4.586 3.024A4.455 4.455 0 0 1 16 8.848V8.9a.75.75 0 0 1-1.5 0Z"></path><path d="m8.38 7.67 2.25 2.25a.749.749 0 0 1 0 1.061L8.38 13.23a.749.749 0 1 1-1.06-1.06l1.719-1.72L7.32 8.731A.75.75 0 0 1 8.38 7.67ZM15 13.45h-3a.75.75 0 0 1 0-1.5h3a.75.75 0 0 1 0 1.5Z"></path></svg>单击“任务**”按钮。 -
使用提示字段中的下拉菜单,选择要使用的存储库 Copilot 。
-
键入描述请求的提示。
例如:
Implement a user friendly message for common errors.如果要 Copilot 打开拉取请求,可以在提示中提问,例如
Open a pull request to implement a user friendly message for common errors. -
可选地为 Copilot 的拉取请求选择一个基分支。 Copilot 将基于此分支创建新分支。
-
(可选)如果您想分配一个代理或一个具有专用行为和工具的,可以单击自定义智能体以打开代理下拉菜单。 可以从存储库、组织或企业中选择现有 自定义智能体。 还可以单击“创建代理”,在所选存储库和分支中创建新的代理资料代理。 有关详细信息,请参阅“为Copilot云代理创建自定义代理”。
注意
第三方代理可用于 GitHub Copilot Pro、GitHub Copilot Pro+、GitHub Copilot业务 和 GitHub Copilot Enterprise 计划。
-
单击“立即发送” 或按“返回”。
你将被带到“代理”选项卡,并 Copilot 启动一个新会话,该会话将显示在提示框下方的“最近会话”列表中。 Copilot 将处理任务并推送任何代码更改。
注意
如果已启用功能预览版 中的“新建仪表板体验 ”,新会话将显示在仪表板的提示框下的“代理会话” 中。 有关详细信息,请参阅“个人仪表板”。
要求 Copilot 在 副驾驶聊天 中从 Visual Studio Code
创建 Pull Request
-
在 GitHub Copilot 聊天功能 中打开 Visual Studio Code。
-
请键入您希望Copilot执行的操作提示。
例如:
Put backticks around file names and variables in output提示
为了帮助Copilot,可以在提交提示之前选择相关的代码行。
-
单击将此任务委托给 GitHub Copilot 云代理按钮,靠近发送按钮。
-
如果有本地更改,将显示一个对话框,询问是否要推送这些更改,以便 Copilot 可以从当前状态开始。 单击 “包含更改 ”以推送更改,或 忽略更改 以要求 Copilot 从存储库的默认分支启动其工作。
Copilot 将启动一个新会话,并使用其创建的拉取请求链接进行响应。 它将处理任务并将更改推送到拉取请求,然后在完成时将你添加为审阅者,同时触发通知。
在 JetBrains IDE 中要求 Copilot 从 副驾驶聊天 创建拉取请求
注意
Copilot云代理 在 JetBrains IDE 中 公共预览版,可能会更改。
-
在 JetBrains IDE 中打开 GitHub Copilot 聊天功能 。
-
键入描述要Copilot执行的提示
例如:
Put backticks around file names and variables in output -
单击“发送”按钮旁边的“委托到云代理”按钮。
Copilot 将启动一个新会话,并使用其创建的拉取请求链接进行响应。 它将处理任务并将更改推送到拉取请求,然后在完成时将你添加为审阅者,并在 IDE 中触发通知 GitHub 。
在 Eclipse 中要求 Copilot 从 副驾驶聊天 创建拉取请求
注意
Copilot云代理 位于 Eclipse 中的 公共预览版,并且可能会更改。
-
在 Eclipse 中打开 GitHub Copilot 聊天功能 。
-
请键入您希望Copilot执行的操作提示。
例如:
Put backticks around file names and variables in output -
单击“”******** 按钮旁边的按钮。
-
在打开的对话框中,选择要在其中工作的存储库 Copilot ,然后单击“ 继续”。
Copilot 将启动一个新会话,并使用其创建的拉取请求链接进行响应。 它将处理任务并将更改推送到拉取请求,然后在完成时将你添加为审阅者,并在 IDE 中触发通知 GitHub 。
要求 Copilot 在 副驾驶聊天 2026 中从 Visual Studio 创建拉取请求
-
在Copilot云代理中启用Visual Studio支持。
- 打开 “工具” 菜单,然后单击“ 选项”。
- 在边栏中,选择 GitHub。
- 勾选“启用 Copilot 云代理(预览版)”选项框。
- 重启 Visual Studio。
-
在 GitHub Copilot 聊天功能 中打开 Visual Studio。
-
输入提示,提供要 Copilot 更改的内容的详细信息。
例如:
Put backticks around file names and variables in log output. -
单击 委派此任务给 GitHub Copilot 云代理 按钮,该按钮位于 发送 按钮旁边,以提交提示。
Copilot 要求你确认要使用云代理创建拉取请求。 -
单击确认。
Copilot 将启动一个新会话,并使用其创建的拉取请求链接进行响应。 它将处理任务并将更改推送到拉取请求,然后在完成时将你添加为审阅者,同时触发通知。
要求 Copilot 在 副驾驶聊天 中从 GitHub.com 创建 Pull Request
-
在 GitHub Copilot 聊天功能 上打开 GitHub.com。
-
键入
/task以请求 Copilot 创建拉取请求,并提供有关要 Copilot 更改的内容的详细信息。例如:
/task Create a pull request to put backticks around file names and variables in output. -
可选地为 Copilot 的拉取请求选择一个基分支。 Copilot 将基于此分支创建新分支,然后将更改推送到面向该分支的拉取请求。
-
(可选)如果您想分配一个代理或一个具有专用行为和工具的,可以单击自定义智能体以打开代理下拉菜单。 可以从存储库、组织或企业中选择现有 自定义智能体。 还可以单击“创建代理”,在所选存储库和分支中创建新的代理资料代理。 有关详细信息,请参阅“为Copilot云代理创建自定义代理”。
注意
第三方代理可用于 GitHub Copilot Pro、GitHub Copilot Pro+、GitHub Copilot业务 和 GitHub Copilot Enterprise 计划。
-
单击 或按 Enter。
Copilot 将启动一个新会话,该会话将显示在提示框下面的列表中。 Copilot 将处理任务并将更改推送到其拉取请求中,任务完成后,它会将你添加为审阅者,并触发通知。
Copilot要求从GitHub Mobile开始工作
-
在 GitHub Mobile 中,点击屏幕右下角的 图标,然后点击 新会话。
-
使用提示字段中的下拉菜单,选择要使用的存储库 Copilot 。
-
输入一个提示,描述您的请求。
例如:
Implement a user friendly message for common errors.。如果要 Copilot 打开拉取请求,可以在提示中提问,例如
Open a pull request to implement a user friendly message for common errors. -
(可选)为 Copilot 的变更选择基分支。 Copilot 将基于此分支创建新分支。
-
(可选)从下拉菜单中选择具有专用行为和工具的 自定义智能体。 有关详细信息,请参阅“为Copilot云代理创建自定义代理”。
-
(可选)可以使用下拉菜单来选择将使用的 Copilot 模型。 有关详细信息,请参阅“更改 GitHub Copilot 云代理的 AI 模型”。
-
单击“提交”按钮。
Copilot 将启动一个新会话,处理任务并推送任何代码更改。在会话日志中,只需单击一次即可追踪 Copilot的工作并打开拉取请求。 有关详细信息,请参阅“跟踪 GitHub Copilot 的会话”。
从Copilot请求创建拉取请求到GitHub CLI
注意
`agent-task` 命令集仅在 GitHub CLI 的 v2.80.0 或更高版本中可用。 此命令集是一个 公共预览版 且可能会更改。
您可以在Copilot云代理中使用gh agent-task create命令启动新的GitHub CLI会话。
在没有任何参数的情况下运行命令时,系统会要求输入提示。 Copilot云代理 对提示进行操作,并在当前存储库中打开拉取请求。
可使用命令行选项执行以下操作:
- 提供提示 (
gh agent-task create "Example prompt") - 选择一个基础分支,而不是使用该仓库的默认分支 (
--base) - 选择一个仓库,而非以当前仓库 (
--repo) 为目标 - 实时跟踪会话日志 (
--follow)
要查看所有可用选项,请运行 gh agent-task create --help。
请Copilot从GitHub MCP 服务器创建一个拉取请求
注意
- 此功能仅适用于支持远程 MCP 服务器的远程 GitHub MCP 服务器和主机应用程序。
-
在 GitHub 首选 IDE 或代理编码工具中安装 MCP 服务器。 请参阅“在 IDE 中使用 GitHub MCP 服务器”。
-
确保启用
create_pull_request_with_copilot工具。 -
打开聊天。
-
请输入提示,要求Copilot创建一个拉取请求,并提供您希望更改的具体详细信息。
例如:
Open a PR in my repository to expand unit test coverage.提示
- 可以通过将特定分支包含在提示符中,要求 Copilot 使用该分支作为基分支打开拉取请求。
-
提交提示。
Copilot 将启动一个新会话,打开一个草稿拉取请求,并在后台处理任务。 在它工作时,它会将更改推送到拉取请求,完成后,它会将你添加为审阅者。 在大多数情况下,MCP 主机将显示创建的拉取请求的 URL。
要求 Copilot 从 Raycast 创建拉取请求
Raycast 是适用于 Windows 和 macOS 的可扩展启动器。 GitHub Copilot使用 Raycast 的扩展,您可以在您的计算机上随时随地启动和跟踪Copilot云代理任务,并实时观看会话日志。
-
从 Raycast 网站安装 Raycast。
-
GitHub Copilot单击**扩展页上的**“[安装扩展](https://www.raycast.com/github/github-copilot)”按钮,安装 Raycast 的扩展。 -
打开 Raycast,搜索“Copilot”,找到“创建任务”命令,然后按Enter。
-
单击 使用 GitHub 登录,然后完成身份验证流程。 Raycast 将重新打开。
-
输入提示,描述您希望 Copilot 执行的操作。
例如:
Implement a user friendly message for common errors. -
选择要在其中工作的存储库 Copilot 。
-
可选地为 Copilot 的拉取请求选择一个基分支。 Copilot 将基于此分支创建新分支,然后将更改推送到面向该分支的拉取请求。
-
(可选)从下拉菜单中选择具有专用行为和工具的 自定义智能体。 有关详细信息,请参阅“为Copilot云代理创建自定义代理”。
-
(可选)可以使用下拉菜单来选择将使用的 Copilot 模型。 有关详细信息,请参阅“更改 GitHub Copilot 云代理的 AI 模型”。
-
按 Command+Enter (macOS) 或 Ctrl+Enter (Windows) 启动任务。
Copilot 将启动新会话。 Copilot 将处理任务并将更改推送到其拉取请求中,任务完成后,它会将你添加为审阅者,并触发通知。
注意
如果在启动任务时无法选择特定存储库,则拥有该存储库的组织可能已启用 OAuth app 访问限制。 要了解如何请求批准“GitHub Copilot for Raycast” OAuth app,请参阅 请求组织批准 OAuth 应用。
Copilot请求从“新建存储库”页创建拉取请求
创建新存储库时,可以通过输入提示来请求 Copilot 为新存储库设定种子。
-
在任何页面的右上角,选择 ,然后单击“新建存储库”。

-
使用“所有者”下拉菜单选择你想要拥有存储库的帐户。

-
在 “提示” 字段中,输入描述您希望 Copilot 构建的内容的提示。
例如,
Create a Rust CLI for converting CSV spreadsheets to Markdown1. 单击“创建存储库”。Copilot 将立即打开草稿拉取请求。 Copilot 将处理任务并将更改推送到其拉取请求中,任务完成后,它会将你添加为审阅者,并触发通知。
监视进度
可以从代理面板、Copilot等查看当前和过去的Visual Studio Code会话。 请参阅“跟踪 GitHub Copilot 的会话”。