Your AI Assistant in the Terminal

GitHub Copilot CLI brings the power of AI directly to your command line

What is GitHub Copilot CLI?

📝

Write Code with Natural Language

Instead of typing complex commands, just describe what you want to do in plain English. Copilot CLI understands your request and helps you build it.

🐛

Debug Smarter

Paste error messages or describe your bug. Copilot CLI analyzes your code and suggests fixes without you having to search Stack Overflow.

🧠

Understand Your Code

Ask questions about how code works, why something might be slow, or how to improve it. Get instant explanations right in your terminal.

🔧

Refactor with Confidence

Let Copilot CLI help you clean up code, improve structure, or modernize outdated patterns. Always review changes before accepting them.

Key Features

✅ GitHub Integration

Directly access your repositories, pull requests, and issues. No context switching needed.

✅ Terminal-Native

Work entirely in your terminal without leaving your command line environment.

✅ Always in Control

Preview every change before execution. You decide what gets applied to your code.

✅ Multiple AI Models

Choose from Claude Sonnet 4.5, Claude Sonnet 4, or GPT-5 based on your needs.

✅ Cross-Platform

Works on Linux, macOS, and Windows with full feature parity.

✅ Extensible

Extend capabilities with custom MCP servers for specialized tasks.

How to Install

Choose your preferred installation method

macOS Installation

Using Homebrew (easiest):

brew install copilot-cli

Or using the install script:

curl -fsSL https://gh.io/copilot-install | bash

Windows Installation

Using WinGet (fastest):

winget install GitHub.Copilot

Linux Installation

Using the install script:

curl -fsSL https://gh.io/copilot-install | bash

Or with sudo for system-wide installation:

curl -fsSL https://gh.io/copilot-install | sudo bash

npm Installation

Works on macOS, Linux, and Windows:

npm install -g @github/copilot

📋 What You Need

Getting Started in 3 Steps

1

Launch Copilot CLI

Open your terminal and type:

copilot
2

Authenticate with GitHub

If this is your first time, you'll be asked to login. Type:

/login

Follow the instructions to authenticate with your GitHub account.

3

Start Asking Questions

You're ready! Try asking something like:

How do I create a React component?

💡 Example Conversations

You: "Create a function that validates email addresses"
Copilot: Generates code with explanation
You: "What does this error mean and how do I fix it?"
Copilot: Analyzes the error and suggests solutions
You: "Refactor this code to be more efficient"
Copilot: Shows improvements with explanations

Essential Commands

Common commands to get the most out of Copilot CLI

/login

Authenticate with your GitHub account

/model

Choose which AI model to use (Claude, GPT, etc.)

/plan

Create a step-by-step implementation plan

/review

Get code review and suggestions for improvements

/clear

Start a fresh conversation (clear history)

/cwd

Change your working directory

/context

See how much of your AI budget you're using

/help

Get help about available commands

@

Mention files to include in context (@filename)

!

Execute shell commands directly in terminal

ctrl+c

Cancel operation or clear input

/exit

Exit Copilot CLI

💬 Pro Tips

  • Use @filename to include specific files in your context
  • Be specific in your questions for better results
  • Use /plan before big tasks to outline steps
  • Preview changes before accepting them
  • Use arrow keys to navigate command history

Best Practices

✏️ Be Specific

Good: "Create a React component that displays a list of users with a search filter"

Avoid: "Make a component"

📂 Provide Context

Use @file to include relevant files so Copilot understands your codebase structure.

🔍 Review Changes

Always review suggested code changes before applying them. Copilot is powerful but not perfect.

🎯 Ask Follow-ups

Don't hesitate to ask clarifying questions or request modifications. The conversation is interactive.

📚 Learn from Explanations

Ask Copilot to explain code it generates. Use it as a learning tool, not just a code generator.

⚙️ Know Your Budget

Use /context to monitor your premium request quota. Each prompt uses one request.

Frequently Asked Questions

Do I need a GitHub Copilot subscription?

Yes, you need an active GitHub Copilot subscription. You can get it through GitHub's subscription plans. If your organization provides Copilot, check if your admin has enabled CLI access.

Does it work with all programming languages?

Yes! Copilot CLI works with any programming language. It's trained on code from Python, JavaScript, Java, C++, Go, Rust, and many more languages.

Is my code shared with GitHub?

Code you share with Copilot CLI (through @ mentions or pasting) is sent to GitHub's servers to process. Review GitHub's privacy policies for details on how this data is handled.

Can I use it offline?

No, Copilot CLI requires an internet connection to communicate with GitHub's servers where the AI models run.

What if I get stuck?

Type /help in Copilot CLI to see all available commands. You can also use /feedback to report issues or suggest improvements.

How much does it cost?

Copilot CLI uses your GitHub Copilot subscription. Each prompt counts as one premium request. Check GitHub's pricing page for subscription costs.

Keyboard Shortcuts

↑ / ↓
Navigate command history
Ctrl + A
Move to beginning of line
Ctrl + E
Move to end of line
Ctrl + C
Cancel or clear input
Ctrl + W
Delete previous word
Ctrl + U
Delete from cursor to beginning
Ctrl + K
Delete from cursor to end
Esc
Cancel current operation