如果你有 GitHub Copilot Individual 订阅,则可以安装 GitHub Copilot in the CLI 扩展,而无需为组织启用它。
如果你是具有 GitHub Copilot Business 或 GitHub Copilot Enterprise 订阅的组织或企业的一部分,那么组织或企业所有者将需要在 Copilot 设置中启用 Copilot in the CLI 。 然后,可以安装 GitHub Copilot in the CLI 扩展。
在组织级别启用或禁用 Copilot in the CLI
组织所有者可以为组织启用或禁用 Copilot in the CLI。 如果企业所有者设置了企业级策略,你可能无法为组织配置此设置。
-
在 GitHub.com 的右上角,选择个人资料照片,然后单击 “你的组织”****。
-
在组织旁边,单击“设置”。
-
在边栏的“代码、规划和自动化”部分中,按下“ Copilot”,然后按下“策略”。********
-
在“Copilot in the CLI”的右侧,选择下拉菜单,然后单击“已启用”或“已禁用”。
在企业级别启用或禁用 Copilot in the CLI
企业所有者可以选择是为所有组织启用功能、为所有组织禁用功能,还是允许每个组织为该功能选择自己的策略。
-
在企业帐户边栏中,单击“ 策略”。
-
在“ 策略”下,单击 Copilot。
-
单击“策略”选项卡。
-
在“GitHub Copilot in the CLI”的右侧,选择下拉菜单,然后选择相应的选项。
- 要允许每个组织设置自己的策略,请选择“无策略”。****
- 要为企业下的所有组织启用 GitHub Copilot Chat,请选择“已启用”****。
- 要为企业中的所有组织禁用 GitHub Copilot,请选择“已禁用”。****
安装 Copilot in the CLI
要安装 Copilot in the CLI,必须先安装 GitHub CLI。 有关 GitHub CLI 的安装说明,请参阅 GitHub CLI 存储库。
-
如果尚未通过 GitHub 帐户进行身份认证,请在终端上运行以下命令。
Shell gh auth login
gh auth login
-
要安装 Copilot in the CLI 扩展,请运行以下命令。
Shell gh extension install github/gh-copilot
gh extension install github/gh-copilot
-
要更新 Copilot in the CLI,请运行以下命令。
Shell gh extension upgrade gh-copilot
gh extension upgrade gh-copilot
要将 gh
与 GitHub Copilot 一起使用,请键入 gh copilot SUBCOMMAND
,例如 gh copilot explain
。
后续步骤
你已成功安装 Copilot in the CLI。 若要详细了解如何使用,请参阅“使用 GitHub Copilot(CLI 版)”。 如果想要为执行命令选项配置使用情况分析和默认行为,请参阅“在 CLI 中配置 GitHub Copilot”。