Skip to main content

About GitHub Copilot in the CLI

GitHub Copilot in the CLI can help you by providing either command suggestions or explanations of given commands.

Who can use this feature?

Owners of organizations or enterprises with a GitHub Copilot Business or GitHub Copilot Enterprise subscription can decide whether to grant access to GitHub Copilot in the CLI for users in their organization or enterprise.

If you have a GitHub Copilot Individual subscription, you now have access to GitHub Copilot in the CLI.

About GitHub Copilot in the CLI

GitHub Copilot in the CLI provides a chat-like interface in the terminal that allows you to ask questions about the command line. You can ask GitHub Copilot to provide either command suggestions or explanations of given commands.

The only supported language for GitHub Copilot in the CLI is English.

GitHub Copilot in the CLI parses your question and provides an answer using a combination of natural language processing and machine learning. This process can be broken down into a number of steps.

Input processing

The input prompt from the user is pre-processed by GitHub Copilot in the CLI and sent to a GitHub service that is connected to a large language model that then generates a response based on the context and prompt. User input can take the form of natural language prompts or questions. It may also include choosing the command type they would like to ask about from a predetermined list, i.e. generic shell command, Git (git), or GitHub CLI (gh). The system is only intended to respond to command line-related questions. For more information about GitHub CLI, see "About GitHub CLI."

Language model analysis

The input prompt is then passed through the language model, which is a neural network that has been trained on a large body of text data. The language model analyzes the input prompt to find the command or command explanation most relevant to your query.

Response generation

The language model generates a response based on its analysis of the input prompt. This response will take the form of a suggested command or an explanation of the command you asked about. If you want to run a suggested command, you need to copy the command and paste it in a separate window or tab in the terminal.

Output formatting

The response generated by GitHub Copilot in the CLI is formatted and presented to you. Copilot in the CLI uses syntax highlighting, indentation, and other formatting features to add clarity to the generated response.

Copilot in the CLI is intended to provide you with the most relevant answer to your question. However, it may not always provide the answer you are looking for. Users of GitHub Copilot in the CLI are responsible for reviewing and validating responses generated by the system to ensure they are accurate and appropriate. Copilot in the CLI also provides an optional feedback mechanism to rate suggestions, which helps us improve the tool for the future. For more information, see "Improving GitHub Copilot in the CLI."

Use cases for GitHub Copilot in the CLI

GitHub Copilot in the CLI can help you by providing either command suggestions or explanations of given commands.

Find the right command to perform a task

GitHub Copilot in the CLI aims to suggest commands that help you perform the tasks you’re trying to complete. To help Copilot in the CLI provide better suggestions, you can specify the type of command you are looking for (generic, git, or gh). If the result isn’t quite what you’re looking for, you can keep revising your question until the returned command meets your expectations. Once you’ve generated the perfect command for your task, you can copy it to your clipboard to run it wherever you need, or you can ask GitHub Copilot in the CLI to execute the command for you.

Explain an unfamiliar command

GitHub Copilot in the CLI can help explain a command that you asked about by generating a natural language description of the command's functionality and purpose. This can be useful if you want to understand the command's behavior for the specific example provided without having to read or search through the command's documentation. The explanation can include information such as the command's input and output parameters and examples of how it could be used.

By generating explanations, GitHub Copilot in the CLI may help you to understand the command better, leading to enhanced learning, improved productivity, and less context switching. However, it's important to note that the generated explanations may not always be accurate or complete, so you'll need to review, and occasionally correct, its output. You remain responsible for ensuring the accuracy and appropriateness of the commands you run in the command line.

Improving GitHub Copilot in the CLI

To enhance the experience and address some of the limitations of GitHub Copilot in the CLI, there are various measures that you can adopt. For more information about the limitations, see "Limitations of GitHub Copilot in the CLI."

Use GitHub Copilot in the CLI as a tool, not a replacement

While GitHub Copilot in the CLI can be a powerful tool for enhancing understanding of commands and the command line, it is important to use it as a tool rather than a replacement for human programming. You should always review and verify the command generated by Copilot in the CLI to ensure that it meets your requirements and is free of errors or security concerns.

Provide feedback

If you encounter any issues or limitations with GitHub Copilot in the CLI, we recommend that you provide feedback by selecting the "Rate response" option in GitHub Copilot in the CLI. This can help the developers to improve the tool and address any concerns or limitations.

Limitations of GitHub Copilot in the CLI

Depending on factors such as your operating system and input data, you may encounter different levels of accuracy when using GitHub Copilot in the CLI. The following information is designed to help you understand system limitations and key concepts about performance as they apply to GitHub Copilot in the CLI.

Limited scope

GitHub Copilot in the CLI operates within defined boundaries and might struggle with intricate commands, less common ones, or more recently developed tools. The quality of suggestions it provides for each language can be influenced by the availability and diversity of training data. For instance, inquiries about well-documented commands and tools like Git may yield more accurate responses compared to questions about more obscure command line tools.

Potential biases and errors

GitHub Copilot in the CLI's training data is sourced from existing online sources. It’s important to note that these sources may include biases and errors of the individuals who contributed to the training data. Copilot in the CLI may inadvertently perpetuate these biases and errors. Additionally, GitHub Copilot in the CLI might perform differently depending on the scripting languages or scripting styles, potentially resulting in suboptimal or incomplete command suggestions or explanations.

Inaccurate responses

GitHub Copilot in the CLI may generate seemingly valid but syntactically or semantically incorrect commands. To avoid issues, always carefully review and verify suggestions, especially for critical or destructive tasks such as deleting content. Ensure generated commands align with best practices and fit your workflow.

Risk management and user accountability in command execution

Additional caution is required with the addition of the functionality to ask GitHub Copilot in the CLI to execute a command, particularly regarding the potential destructiveness of some suggested commands. You may encounter commands for file deletion or hard drive formatting, which can cause problems if used incorrectly. While such commands may be necessary in certain scenarios, you need to be careful when accepting and running these commands.

Additionally, you are ultimately responsible for the commands executed by GitHub Copilot in the CLI. It is entirely your decision whether to use commands generated by GitHub Copilot in the CLI. Despite the presence of fail-safes and safety mechanisms, you must understand that executing commands carries inherent risks. GitHub Copilot in the CLI provides a powerful tool set, but you should approach its recommendations with caution and ensure that commands align with your intentions and requirements.

Inaccurate responses to non-coding topics

GitHub Copilot in the CLI is not designed to answer questions beyond the scope of command line-related tasks. As a result, its responses might not consistently offer accuracy or assistance when confronted with questions unrelated to coding or general command line use. When you inquire about non-coding topics, GitHub Copilot in the CLI may express its inability to provide a meaningful response.

Differing performance based on natural language

GitHub Copilot in the CLI has been trained on natural language content written predominantly in English. As a result, you may notice differing performance when providing GitHub Copilot in the CLI with natural language input prompts in languages other than English.

Further reading