# GitHub Copilot (CLI)

## Install and Setup

* Brew doesn't set up auto-completion for tools, but it works if you set [this up in your shell](/operating-systems/macos/terminal-customization.md#completion-features).

{% code overflow="wrap" %}

```bash
# install 
brew install gh
```

{% endcode %}

```bash
# configure authentication
gh auth login
```

{% code overflow="wrap" %}

```bash
# install the copilot extension
gh extension install github/gh-copilot
```

{% endcode %}

{% code overflow="wrap" %}

```bash
# upgrade the copilot extension
gh extension upgrade gh-copilot
```

{% endcode %}

```bash
# disable usage data
gh copilot config
```

## Usage

```bash
gh copilot <command> "prompt"
```

### **Commands**

* `config` - adjust data collection
* `explain` - explain a command
* `suggest` - suggest a command

### **Explain**

* Prompting Copilot to explain a command to me.&#x20;

<figure><img src="/files/I4FSlfSLH6lOZQ6pIUmC" alt=""><figcaption></figcaption></figure>

### Suggest

* Prompting Copilot to build me a command and then providing feedback to improve the command.

<figure><img src="/files/L5vdHDizO6ax3SEt6Tti" alt=""><figcaption></figcaption></figure>

## Useful Resources

{% embed url="<https://docs.github.com/en/copilot/github-copilot-in-the-cli/using-github-copilot-in-the-cli>" %}

{% embed url="<https://docs.github.com/en/copilot/github-copilot-in-the-cli/setting-up-github-copilot-in-the-cli>" %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.techwithtyler.dev/coding-and-cli-tooling/cli-tools/github-copilot-cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
