Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ By default, the CLI stores your OAuth token in your operating system's keychain
| Windows | Credential Manager |
| Linux | libsecret (GNOME Keyring, KWallet) |

If the system keychain is unavailable—for example, on a headless Linux server without `libsecret` installed—the CLI prompts you to store the token in a plaintext configuration file at `~/.copilot/settings.json`.
If the system keychain is unavailable—for example, on a headless Linux server without `libsecret` installed—the CLI prompts you to store the token in a plaintext configuration file at `~/.copilot/config.json`.

When you run a command, {% data variables.copilot.copilot_cli_short %} checks for credentials in the following order:

Expand Down Expand Up @@ -176,8 +176,8 @@ If you have {% data variables.product.prodname_cli %} installed and authenticate

## Switching between accounts

{% data variables.copilot.copilot_cli_short %} supports multiple accounts. You can list available accounts and switch between them from within the CLI.
To list available accounts, run `/user list` from the {% data variables.copilot.copilot_cli_short %} prompt.
{% data variables.copilot.copilot_cli_short %} supports multiple accounts. You can list available accounts and switch between them from within the CLI.
To list available accounts, run `/user list` from the {% data variables.copilot.copilot_cli_short %} prompt.
To switch to a different account, type `/user switch` on the prompt.

To add another account, run `copilot login` from a new terminal session, or run the login command from within the CLI and authorize with the other account.
Expand All @@ -190,7 +190,7 @@ To revoke the OAuth app authorization on {% data variables.product.github %} and

1. Navigate to **Settings** > **Applications** > **Authorized OAuth Apps**.
1. Navigate to your settings page:
1. In the upper-right corner of any page on {% data variables.product.prodname_dotcom %}, click your profile picture.
1. In the upper-right corner of any page on {% data variables.product.prodname_dotcom %}, click your profile picture.
1. Click **Settings**.
1. In the left sidebar, click **Applications**.
1. Under **Authorized OAuth Apps**, click {% octicon "kebab-horizontal" aria-label="The horizontal kebab icon" %} next to **GitHub CLI** to expand the menu and select **Revoke**.
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ If you choose to trust the directory for future sessions, the trusted directory

### Editing trusted directories

You can edit the list of permanently trusted directories.
You can edit the list of permanently trusted directories. Trusted directories are stored in the automatically managed `config.json` file.

1. Open the CLIs `settings.json` file. By default, its stored in a `.copilot` folder under your home directory:
1. Open the CLI's `config.json` file. By default, it's stored in a `.copilot` folder under your home directory:

* **macOS/Linux**: `~/.copilot/settings.json`
* **Windows**: `$HOME\.copilot\settings.json`
* **macOS/Linux**: `~/.copilot/config.json`
* **Windows**: `$HOME\.copilot\config.json`

You can change the config location by setting the `COPILOT_HOME` environment variable.
You can change the config location by setting the `COPILOT_HOME` environment variable. This would change `~/.copilot/` and `$HOME\.copilot\` in the above paths.

1. Edit the contents of the `trusted_folders` array.
1. Edit the contents of the `trustedFolders` array.

## Setting allowed tools

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Delegating tasks to {% data variables.copilot.copilot_cli %}
shortTitle: Delegate tasks to Copilot
intro: Use {% data variables.copilot.copilot_cli_short %}''s autopilot mode to hand off tasks and have {% data variables.product.prodname_copilot_short %} work autonomously on your behalf.
title: Delegating tasks to {% data variables.product.prodname_copilot_short %}
shortTitle: Delegate tasks to {% data variables.product.prodname_copilot_short %}
intro: Use autopilot mode, or the `/delegate` slash command, to get {% data variables.product.prodname_copilot_short %} to work autonomously on your behalf.
allowTitleToDifferFromFilename: true
product: '{% data reusables.gated-features.copilot-cli %}'
versions:
Expand All @@ -13,9 +13,13 @@ docsTeamMetrics:
- copilot-cli
---

## Get {% data variables.product.prodname_copilot_short %} to work autonomously
{% data variables.copilot.copilot_cli_short %} offers two ways to have {% data variables.product.prodname_copilot_short %} work autonomously: **autopilot mode** and the **`/delegate` command**. Both let you hand off tasks, but they differ in where the work happens:

You can tell {% data variables.product.prodname_copilot_short %} to use its best judgment to complete a task autonomously, rather than the CLI prompting you for input at each decision point within a task. You do this by using the CLI's autopilot mode.
* **Autopilot mode** runs locally in your CLI session. You give autopilot full permissions and {% data variables.product.prodname_copilot_short %} then works on a task without stopping to prompt you for input. Your local machine does the work, and you can watch progress in real time. Use autopilot when you want hands-free local execution.

* **`/delegate`** pushes the task to {% data variables.copilot.copilot_cloud_agent %} on {% data variables.product.github %}. The work runs remotely: {% data variables.product.prodname_copilot_short %} creates a branch, opens a draft pull request, and works in the background. Use `/delegate` when you want to hand off a task entirely and continue running even if you shut down your local machine.

## Get autopilot to complete tasks autonomously on your local machine

There are two ways to use autopilot mode:

Expand All @@ -26,9 +30,7 @@ For more information, see [AUTOTITLE](/copilot/concepts/agents/copilot-cli/autop

## Delegate tasks to {% data variables.copilot.copilot_cloud_agent %}

The delegate command lets you push your current session to {% data variables.copilot.copilot_cloud_agent %} on {% data variables.product.github %}. This lets you hand off work while preserving all the context {% data variables.product.prodname_copilot_short %} needs to complete your task.

You can delegate a task using the slash command, followed by a prompt:
You can delegate a task to {% data variables.copilot.copilot_cloud_agent %} on {% data variables.product.github %} by using the `/delegate`slash command, followed by a prompt:

```shell
/delegate complete the API integration tests and fix any failing edge cases
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ docsTeamMetrics:
| Command | Purpose |
|------------------------|----------------------------------------------------|
| `copilot` | Launch the interactive user interface. |
| `copilot completion SHELL` | Print a shell script for the chosen shell that can be used to enable tab completion for {% data variables.copilot.copilot_cli_short %}. Supported shells: `bash`, `zsh`, `fish`. See [Using `copilot completion`](#using-copilot-completion). |
| `copilot help [TOPIC]` | Display help information. Help topics include: `config`, `commands`, `environment`, `logging`, `monitoring`, `permissions`, and `providers`. |
| `copilot init` | Initialize {% data variables.product.prodname_copilot_short %} custom instructions for this repository. |
| `copilot login` | Authenticate with {% data variables.product.prodname_copilot_short %} via the OAuth device flow. Accepts `--host HOST` to specify the {% data variables.product.github %} host URL (default: `https://github.com`). |
Expand All @@ -33,9 +34,8 @@ docsTeamMetrics:
| Option | Purpose |
|-------------------------|-----------------------------------------------------------------------------------------------|
| `--host HOST` | {% data variables.product.github %} host URL (default: `https://github.com`). Use this to authenticate with a {% data variables.product.prodname_ghe_cloud %} instance that uses data residency (for example, `https://example.ghe.com`). |
| `--config-dir PATH` | Set the configuration directory (default: `~/.copilot`). |

The default authentication mode is a web-based browser flow. After completion, an authentication token is stored securely in the system credential store. If a credential store is not found, the token is stored in a plain text config file under `~/.copilot/`.
The default authentication mode is a web-based browser flow. After completion, an authentication token is stored securely in the system credential store. If a credential store is not found, the token is stored in a plain text config file under `~/.copilot/` (or the directory specified by `COPILOT_HOME` if set).

Alternatively, {% data variables.copilot.copilot_cli_short %} will use an authentication token found in environment variables. The following are checked in order of precedence: `COPILOT_GITHUB_TOKEN`, `GH_TOKEN`, `GITHUB_TOKEN`. This method is most suitable for headless use such as automation.

Expand All @@ -54,6 +54,38 @@ copilot login --host https://example.ghe.com
COPILOT_GITHUB_TOKEN=github_pat_... copilot
```

### Using `copilot completion`

The command `copilot completion SHELL` outputs a script for the specified shell (bash, zsh, or fish).

By sourcing this script (or writing it to your shell's completion directory) you can enable tab completion in your terminal for `copilot` subcommands, command options, and known value choices for command options.

#### Usage examples

Bash (current session only):

```bash copy
source <(copilot completion bash)
```

Bash (persistent, Linux):

```bash copy
copilot completion bash | sudo tee /etc/bash_completion.d/copilot
```

Zsh — write the output to a directory on your $fpath. Restart the shell after running this command:

```shell copy
copilot completion zsh > "${fpath[1]}/_copilot"
```

Fish:

```shell copy
copilot completion fish > ~/.config/fish/completions/copilot.fish
```

## Global shortcuts in the interactive interface

| Shortcut | Purpose |
Expand Down Expand Up @@ -182,7 +214,6 @@ For a complete list of available slash commands enter `/help` in the CLI's inter
| `--available-tools=TOOL ...` | Only these tools will be available to the model. For multiple tools, use a quoted, comma-separated list. See [AUTOTITLE](/copilot/how-tos/copilot-cli/allowing-tools). |
| `--banner`, `--no-banner` | Show or hide the startup banner. |
| `--bash-env` | Enable `BASH_ENV` support for bash shells. |
| `--config-dir=PATH` | Set the configuration directory (default: `~/.copilot`). |
| `--connect[=SESSION-ID]` | Connect directly to a remote session (optionally specify a session ID or task ID). Conflicts with `--resume` and `--continue`. |
| `--continue` | Resume the most recent session in the current working directory, falling back to the globally most recent session. |
| `--deny-tool=TOOL ...` | Tools the CLI does not have permission to use. Will not prompt for permission. For multiple tools, use a quoted, comma-separated list. |
Expand Down Expand Up @@ -332,7 +363,7 @@ copilot --allow-tool='MyMCP'
For detailed information about configuration file settings—including the full list of user settings, repository settings, local settings, and how they cascade—see [AUTOTITLE](/copilot/reference/copilot-cli-reference/cli-config-dir-reference#configuration-file-settings).

> [!NOTE]
> User settings were previously stored in `~/.copilot/config.json`. Existing settings in that location are automatically migrated to `~/.copilot/settings.json` on startup.
> User settings were previously stored in `~/.copilot/config.json`. Existing user-editable settings in that location are automatically migrated to `~/.copilot/settings.json` on startup.

## Project initialization for {% data variables.product.prodname_copilot_short %}

Expand Down Expand Up @@ -944,7 +975,6 @@ Use `copilot mcp` to manage MCP server configurations from the command line with
| `--timeout <ms>` | Timeout in milliseconds. |
| `--json` | Output added configuration as JSON. |
| `--show-secrets` | Show full environment variable and header values. |
| `--config-dir <path>` | Path to the configuration directory. |

> [!CAUTION]
> `--show-secrets` can print sensitive environment variable and header values to your terminal or logs. Only use this option in trusted environments, and avoid copying, pasting, or otherwise capturing the output in shared logs or history.
Expand Down
Loading
Loading