> For the complete documentation index, see [llms.txt](https://www.techwithtyler.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.techwithtyler.dev/coding-and-cli-tooling/cli-tools/github-copilot-cli.md).

# GitHub Copilot (CLI)

Tips and tricks for setting up and using GitHub Copilot with the 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="https://2721275171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8yu8YbDfwd1VqEdUxGyA%2Fuploads%2FZmzzmfxZvrmwWyNesyPJ%2Fimage.png?alt=media&amp;token=a9c1af9c-0f40-4b1b-8120-cf0250623bb6" alt=""><figcaption></figcaption></figure>

### Suggest

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

<figure><img src="https://2721275171-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F8yu8YbDfwd1VqEdUxGyA%2Fuploads%2Fd8gaeXN9128GYVurHxtp%2Fimage.png?alt=media&amp;token=c43ce7fe-37fb-4ac2-bf3c-de5445082533" 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>" %}
