How to Install and Use GitHub Copilot CLI: A Complete Guide (2025)
Step-by-step guide on how to install and use the official GitHub Copilot CLI. Learn the correct npm installation, setup, and see practical examples for shell, Git, and more.
npm-based Copilot CLI.Key Features
- Agent-Powered and GitHub-Native: Access repositories, issues, and pull requests using natural language. The CLI knows your project context, allowing for truly repository-aware conversations.
- Build, Edit, and Debug Faster: Collaboratively build, edit, debug, and refactor code. Copilot CLI can execute tasks, edit files, and help you iterate without leaving the terminal.
- Collaboration with Full Control: Every file change and command requires your explicit approval, so you always stay in control. It also inherits your organization's existing Copilot governance policies, ensuring security and compliance.
Prerequisites
- Node.js: Version 22 or higher.
- npm: Version 10 or higher.
- PowerShell (for Windows users): Version 6 or higher.
- An active GitHub Copilot Subscription: You must have a Copilot Pro, Pro+, Business, or Enterprise plan.
Installation and Setup
npm package.Step 1: Install the Package Globally
example.sh1npm install -g @github/copilotBASHUTF-8
Step 2: Launch and Authenticate
copilot command in your terminal:example.sh1copilotBASHUTF-8
/login command, which will guide you through the browser-based authentication process to verify your Copilot subscription.How to Use the Copilot CLI
gh extension, the Copilot CLI provides an interactive, agentic shell. You launch it once and then give it instructions in plain English. It maintains context within your session and your current working directory.- Navigate to your project's root directory:
cd /path/to/your/project - Launch the Copilot CLI:
copilot - Once the Copilot prompt (
>) appears, simply type what you want to do.

Practical Examples
Example 1: Finding Files
find, you can just ask Copilot.> find all files larger than 10MB in the current directory
Example 2: Complex Git Operations
> find all commits by 'Ufuk Ozen' in the last month with the message 'refactor'
git log command for you.Example 3: Running a Docker Container
> run a new nginx docker container named my-nginx, map port 8080 to 80, and mount the current directory's html folder
docker run command with all the specified flags and volumes.The GitHub Advantage: Deep Integration
"list the open issues assigned to me""how many pull requests do I have open?""show me my unmerged pull requests"
"who has fixed the most bugs in the last month?""who contributed the most new code to the main branch?"
Advanced: Switching AI Models
COPILOT_MODEL environment variable when launching the tool:example.sh1COPILOT_MODEL=gpt-5 copilotBASHUTF-8
Why This Is a Game-Changer
- Less Setup, More Shipping: Spend less time looking up obscure syntax and more time building what matters.
- Seamless Workflow: Stay focused in your terminal without the constant context-switching between your editor, browser, and other tools.
- Autonomous Task Execution: Handle complex, multi-step implementations from a single natural language prompt, letting the AI do the heavy lifting.



