{"meta":{"title":"Getting started with GitHub Copilot CLI","intro":"Quickly learn how to use GitHub Copilot CLI.","product":"GitHub Copilot","breadcrumbs":[{"href":"/en/copilot","title":"GitHub Copilot"},{"href":"/en/copilot/how-tos","title":"How-tos"},{"href":"/en/copilot/how-tos/copilot-cli","title":"Copilot CLI"},{"href":"/en/copilot/how-tos/copilot-cli/cli-getting-started","title":"Copilot CLI quickstart"}],"documentType":"article"},"body":"# Getting started with GitHub Copilot CLI\n\nQuickly learn how to use GitHub Copilot CLI.\n\n## Introduction\n\nGitHub Copilot CLI is a powerful terminal-native AI coding assistant that brings agentic capabilities directly to your command line. The Copilot CLI offers deep flexibility, GitHub workflow integration, and the ability to work autonomously on complex tasks while maintaining full user control.\n\nThis guide will help you start using the CLI.\n\n## Installation\n\nUse one of these commands:\n\n* **Cross-platform (npm)**\n\n  Prerequisite: Node.js 22 or later.\n\n  ```bash copy\n  npm install -g @github/copilot\n  ```\n\n* **Windows (WinGet)**\n\n  ```bash copy\n  winget install GitHub.Copilot\n  ```\n\n* **macOS/Linux (Homebrew)**\n\n  ```bash copy\n  brew install copilot-cli\n  ```\n\n## Starting the CLI for the first time\n\n1. In the terminal, navigate to the project directory where you want to use Copilot CLI.\n\n2. Start an interactive CLI session:\n\n   ```bash\n   copilot\n   ```\n\n3. In the CLI interface, enter `/login` and follow the on-screen prompts to authenticate with your GitHub account.\n\n   You'll only have to do this the first time you use the CLI.\n\n4. When prompted, confirm that you trust that the files in the current directory are suitable for use with an AI tool.\n\n   > \\[!NOTE]\n   > Copilot won't make changes to your files without your explicit approval.\n\n5. Try asking Copilot a question, for example:\n\n   ```copilot copy\n   Give me an overview of this project.\n   ```\n\n## Core shortcuts to master\n\n| Shortcut                      | Action                                   |\n| ----------------------------- | ---------------------------------------- |\n| <kbd>Esc</kbd>                | Cancel the current operation             |\n| <kbd>Ctrl</kbd>+<kbd>C</kbd>  | Cancel if thinking, clear input, or exit |\n| <kbd>Ctrl</kbd>+<kbd>L</kbd>  | Clear the screen                         |\n| `@`                           | Mention files to include in context      |\n| `/`                           | Show slash commands                      |\n| `?`                           | Show tabbed help                         |\n| <kbd>↑</kbd> and <kbd>↓</kbd> | Navigate the command history             |\n\nFor a full list of shortcuts and available commands, enter:\n\n```bash\n/help\n```\n\n## Using GitHub Copilot CLI non-interactively\n\nYou can also enter a command and get a response from Copilot directly in your terminal, without starting an interactive session.\n\nTo do this, pass a prompt to the CLI with the `-p` flag. For example:\n\n```bash\ncopilot -p \"In Git, how can I apply a commit from another branch\"\n```\n\nThe `-p` flag allows you to use GitHub Copilot CLI programmatically within scripts, for example to automate tasks using AI.\n\nYou can add the `-s` flag to tell the CLI to output only Copilot's response, omitting the additional usage information.\n\n```bash\ncopilot -sp \"YOUR PROMPT HERE\"\n```\n\nFor details of other flags you can use programmatically, and for more information, enter:\n\n```bash\ncopilot help\n```\n\nor:\n\n```bash\ncopilot help TOPIC\n```\n\nwhere TOPIC is one of the topics listed in the help output.\n\n## Next steps\n\nFind out more about Copilot CLI:\n\n* [About GitHub Copilot CLI](/en/copilot/concepts/agents/about-copilot-cli)\n* [Using GitHub Copilot CLI](/en/copilot/how-tos/use-copilot-agents/use-copilot-cli)\n* [Best practices for GitHub Copilot CLI](/en/copilot/how-tos/copilot-cli/cli-best-practices)\n* [Get started with GitHub Copilot CLI: A free hands-on course](https://developer.microsoft.com/blog/get-started-with-github-copilot-cli-a-free-hands-on-course)"}