Примечание.
GitHub Copilot CLI находится в Общедоступная предварительная версия с защитой данных и может быть изменен.
To find out about Интерфейс командной строки Copilot before you install it, see About GitHub Copilot CLI.
Prerequisites
- An active GitHub Copilot subscription. See Copilot plans.
- (On Windows) PowerShell v6 or higher
If you have access to GitHub Copilot via your organization or enterprise, you cannot use Интерфейс командной строки Copilot if your organization owner or enterprise administrator has disabled it in the organization or enterprise settings. See Управление политиками и функциями для GitHub Copilot в организации.
Installing or updating Интерфейс командной строки Copilot
You can install Интерфейс командной строки Copilot using WinGet (Windows), Homebrew (macOS and Linux), npm (all platforms), or an install script (macOS and Linux).
Installing with npm (all platforms)
Prerequisite: Node.js версии 22 или более поздней.
npm install -g @github/copilot
npm install -g @github/copilot
Примечание.
If you have ignore-scripts=true in your ~/.npmrc file, you must use the command:
npm_config_ignore_scripts=false npm install -g @github/copilot
npm_config_ignore_scripts=false npm install -g @github/copilot
To install the prerelease version:
npm install -g @github/copilot@prerelease
npm install -g @github/copilot@prerelease
Installing with WinGet (Windows)
winget install GitHub.Copilot
winget install GitHub.Copilot
To install the prerelease version:
winget install GitHub.Copilot.Prerelease
winget install GitHub.Copilot.Prerelease
Installing with Homebrew (macOS and Linux)
brew install copilot-cli
brew install copilot-cli
To install the prerelease version:
brew install copilot-cli@prerelease
brew install copilot-cli@prerelease
Installing with the install script (macOS and Linux)
curl -fsSL https://gh.io/copilot-install | bash
curl -fsSL https://gh.io/copilot-install | bash
Or:
wget -qO- https://gh.io/copilot-install | bash
wget -qO- https://gh.io/copilot-install | bash
To run as root and install to /usr/local/bin, use | sudo bash.
To install to a custom directory, set the PREFIX environment variable. It defaults to /usr/local when run as root or $HOME/.local when run as a non-root user.
To install a specific version, set the VERSION environment variable. It 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
curl -fsSL https://gh.io/copilot-install | VERSION="v0.0.369" PREFIX="$HOME/custom" bash
Download from GitHub.com
You can download the executables directly from the copilot-cli repository.
Download the executable for your platform, unpack it, and run.
Authenticating with Интерфейс командной строки Copilot
On first launch, 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.
Authenticating with a personal access token
You can also authenticate using a fine-grained personal access token with the "Copilot Requests" permission enabled.
- Visit Fine-grained personal access tokens.
- Under "Permissions," click Add permissions and select Copilot Requests.
- Click Generate token.
- Add the token to your environment using the
GH_TOKENorGITHUB_TOKENenvironment variable (in order of precedence).
Next steps
You can now use Copilot from the command line. See Использование интерфейса командной строки GitHub Copilot.