Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Ask for assistance right in your terminal.

NotificationsYou must be signed in to change notification settings

github/gh-copilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

GitHub Copilot in the CLI is an extension forGitHub CLI which provides a chat-like interface in the terminal that allows you to ask questions about the command line. You can ask Copilot in the CLI to suggest a command for your use case withgh copilot suggest, or to explain a command you're curious about withgh copilot explain.

For use cases, enabling, and limitations, see "GitHub Copilot in the CLI".

For what data is collected, used, and shared, see "Privacy Policies".

For help troubleshooting connectivity, see "Troubleshooting network errors for GitHub Copilot".

Quickstart

Note

To use and install GitHub Copilot in the CLI, you must have an activeGitHub Copilot subscription, haveGitHub CLI installed, and authenticate using the GitHub CLI OAuth app.

Classic and fine-grained PATs are currently unsupported and might require clearing theGITHUB_TOKEN andGH_TOKEN environment variables.

Important

GitHub Copilot in the CLI does not currently have plans to support 32-bit Android distributions.

For more information, see#122.

  1. Authenticate with GitHub CLI OAuth app
    gh auth login --web
  2. Install / upgrade extension
    gh extension install github/gh-copilot --force
  3. Suggest a command
    gh copilot suggest"Install and configure git lfs"
  4. Explain a command
    gh copilot explain'git lfs migrate import --everything --include="*.gz,*.png,*.jar"'

Usage

$ gh copilot --helpYour AIcommand line copilot.Usage:  copilot [command]Examples:$ gh copilot suggest"Install git"$ gh copilot explain"traceroute github.com"Available Commands:alias       Generate shell-specific aliasesfor convenience  config      Configure options  explain     Explain acommand  suggest     Suggest acommandFlags:  -h, --helphelpfor copilot      --hostname string   The GitHub host to usefor authentication  -v, --version           versionfor copilotUse"copilot [command] --help"for more information about a command.

Multi-account notes

Multi-account users can use--hostname flag orGH_HOST environment variable to specify the GitHub hostname for commands that would otherwise assume thegithub.com host.

Set up optional helpers

Isgh copilot suggest ... too many keystrokes? Do you want support for executing suggestions and keeping them in history?

v1.0.0 introducesgh copilot alias, which generates shell configuration forghcs andghce aliases that wrapgh copilot suggest andgh copilot explain. These aliases provide faster invocation and support executing suggested commands if applicable. Executed suggestions are added to your shell history for reuse later.

$ ghcs print"Hello world"Welcome to GitHub Copilotin the CLI!version 1.0.0 (2024-03-21)I'm powered by AI, so surprises and mistakes are possible. Make sure to verify any generated code or suggestions, and share feedback so that we can learn and improve. For more information, see https://gh.io/gh-copilot-transparencySuggestion:  echo "Hello world"? Select an option> Execute command? Are you sure you want to execute the suggested command?> YesHello world

To setup these optional helpers, see below for setup instructions for supported shells:

For more information, rungh copilot alias --help.

For changing the execute command confirmation behavior, rungh copilot config to changeDefault value for confirming command execution.

Bash

echo'eval "$(gh copilot alias -- bash)"'>>~/.bashrc

PowerShell

Note

PowerShell users might need to update the file containinggh-copilot helpers after updating the extension.

$GH_COPILOT_PROFILE=Join-Path-Path$(Split-Path-Path$PROFILE-Parent)-ChildPath"gh-copilot.ps1"gh copilot alias-- pwsh|Out-File (New-Item-Path$GH_COPILOT_PROFILE-Force )echo".`"$GH_COPILOT_PROFILE`"">>$PROFILE

Zsh

echo'eval "$(gh copilot alias -- zsh)"'>>~/.zshrc

Metrics sent to GitHub

GitHub Copilot in the CLI sends certain metrics to our analytics system. We want you to understand what is beingsent and why it's important to our ability to continue to improve the product and provide you with a better experienceover time.

Why do we need usage stats?

Our team uses metrics to prioritize our work and evaluate whether we are successful in solving real user problems afterwe've released something. For example, when we release a new version and see a spike in exceptions and response ratings,we want to understand if there is a regression or a platform issue causing problems.

The more people who opt in to send usage stats, the more information we have to base our decision-making on. And if youwant us to take your use cases into consideration, we hope you'll opt in so we get a better idea of how you use the appand whether or not it's meeting your needs. GitHub Copilot in the CLI will send a payload in the format below to ouranalytics system unless you've opted out. We are very sensitive to the privacy of our users and we never look at the dataof specific individuals, but rather only examine aggregate data and trends to inform our product decisions.

You can change your opt-in setting at any time ingh copilot config:

$ gh copilot configWelcome to GitHub Copilot CLI!version 0.3.0-beta (2023-10-31)I'm powered by AI, so surprises and mistakes are possible. Make sure to verify any generated code or suggestions, and share feedback so that we can learn and improve.? What would you like to configure?> Optional Usage Analytics? Allow GitHub to collect optional usage data to help us improve? This data does not include your queries.  [Use arrows to move, type to filter]> Yes  No

Example usage stats

{"platform":"darwin","architecture":"arm64","version":"1.1.0","custom_event":"true","event_parent_command":"explain","event_name":"Explain","sha":"089a53215fc4383179869f7f6132ce9d6e58754a","thread_id":"e61d0d08-f6ba-465b-81cf-c30fd9127d70","host":"github.com"}

[8]ページ先頭

©2009-2025 Movatter.jp