# How to Use GitHub Copilot CLI in Your Terminal

> Install GitHub Copilot CLI, log in, ask it for a command or a code change, and control what it's allowed to run. Copy-paste.

- Canonical: https://guides-ai.pages.dev/guides/github-copilot-cli-first-steps/
- Plate 14.03 · Topic: Other coding agents (https://guides-ai.pages.dev/topics/agents/)
- Published: 06 Sept 2026 · 3 min read
- Source site: guides-ai — https://guides-ai.pages.dev/

GitHub Copilot CLI brings Copilot's coding agent into your terminal. It needs an active
Copilot subscription.

## 1. Install it

```bash
npm install -g @github/copilot
```

That needs **Node.js 22 or later**. WinGet, Homebrew, and a standalone install script are also
supported. On Windows you need **PowerShell v6+**.

## 2. Start it and log in

```bash
copilot
```

If you aren't logged in to GitHub, Copilot prompts you to run:

```text
/login
```

Follow the on-screen instructions. For unattended use, it also reads a fine-grained personal
access token with the **Copilot Requests** permission from an environment variable —
`COPILOT_GITHUB_TOKEN`, `GH_TOKEN`, or `GITHUB_TOKEN`, in that order of precedence.

## 3. Ask it something

Start it in the project you want it to work on, then type a plain request:

```text
Explain what the retry logic in fetch_orders() does and why it can loop forever.
```

```text
Write a make target that runs the test suite with coverage and fails under 80%.
```

It's an agent, not an autocomplete: it reads files, proposes commands, and asks before running
them. Read each proposed command before approving it.

## 4. Permissions, directories, and sessions

The commands worth knowing on day one:

- `/add-dir /path/to/directory` — trust another directory so it can read and edit there.
- `/sandbox enable` — turn on local sandboxing.
- `/mcp add` — attach an [MCP server](/guides/install-mcp-server-claude-code/).
- `/context`, `/usage`, `/compact` — see and shrink what's in the context window.
- `/resume` (or the `--resume` option) — pick up an earlier session; `--continue` reopens the
  most recently closed local one.

There is a `--allow-all` (alias `--yolo`) flag that enables all permissions. Use it only in a
throwaway container or a sandboxed checkout — it removes the approval step that keeps a bad
command from running against your real working tree.

---

Next: [Codex CLI first steps](/guides/codex-cli-first-steps/) or
[connect Claude Code to GitHub](/guides/connect-claude-code-to-github/).
