Prev Next

AI / GitHub Copilot CLI Fundamentals Interview Questions

1. What is GitHub Copilot CLI and how does it differ from the deprecated gh copilot extension? 2. What are the prerequisites for installing GitHub Copilot CLI? 3. How do you install GitHub Copilot CLI? 4. How do you authenticate GitHub Copilot CLI and what token types are supported? 5. What is the directory trust model in GitHub Copilot CLI and why does it exist? 6. How do you start an interactive Copilot CLI session and what are the two main usage modes? 7. What are slash commands in GitHub Copilot CLI and what are the most important ones? 8. What are the operating modes in GitHub Copilot CLI and how do you switch between them? 9. What is the copilot-instructions.md file and how does it affect Copilot CLI behaviour? 10. How does model selection work in GitHub Copilot CLI? 11. What is the /pr slash command in GitHub Copilot CLI and what can it do? 12. What is the /fleet slash command and what problem does it solve? 13. What is remote control in GitHub Copilot CLI and how does it work? 14. What are Copilot CLI hooks and what can they be used for? 15. What is the AGENTS.md file and how does it differ from copilot-instructions.md? 16. What is the /chronicle slash command and what session history features does it provide? 17. What is MCP (Model Context Protocol) support in Copilot CLI and how do you use it? 18. What is the COPILOT_HOME environment variable and where does Copilot CLI store its config? 19. What are experimental features in Copilot CLI and how do you enable them? 20. What is AI Credits billing in GitHub Copilot CLI and how does it work? 21. How does Copilot CLI read and understand repository context? 22. What are the keyboard shortcuts available in an interactive Copilot CLI session? 23. What is the difference between GitHub Copilot CLI and Copilot in VS Code? 24. What is GitHub Copilot Workspace and how does it differ from Copilot CLI? 25. What are common Copilot CLI troubleshooting steps and how do you debug issues? 26. How does Copilot CLI differ between Copilot Individual, Business, and Enterprise plans? 27. How do you use Copilot CLI effectively with private repositories? 28. What are best practices for writing effective prompts in GitHub Copilot CLI? 29. How can you use GitHub Copilot CLI in CI/CD pipelines and automation workflows? 30. What security considerations should developers be aware of when using GitHub Copilot CLI? 31. What is the --delegate flag and how does the /delegate slash command work? 32. What logging and diagnostic capabilities does GitHub Copilot CLI provide? 33. What does GitHub Copilot CLI's diff and undo capability provide? 34. What are the Windows-specific considerations for GitHub Copilot CLI? 35. What is the full list of GitHub Copilot CLI command-line flags and their purposes? 36. How does GitHub Copilot CLI integrate with GitHub issues? 37. What are the key differences when using Copilot CLI on macOS vs Linux? 38. What is the overall workflow for using Copilot CLI on a real development task from start to finish?
Could not find what you were looking for? send us the question and we would be happy to answer your question.

1. What is GitHub Copilot CLI and how does it differ from the deprecated gh copilot extension?

GitHub Copilot CLI is a standalone, terminal-native AI coding assistant that brings agentic capabilities directly to your command line. Invoked with the copilot command, it functions as an active collaborator capable of reading, modifying, and executing files, interacting with GitHub, and completing multi-step development tasks.

Copilot CLI vs deprecated gh copilot extension
FeatureNew Copilot CLI (copilot)Deprecated gh copilot extension (gh copilot)
Invocationcopilotgh copilot suggest / gh copilot explain
ModeAgentic - executes tasks autonomouslyCommand suggester - returned text to copy
File accessYes - reads, writes, executes filesNo - text output only
GitHub integrationNative - issues, PRs, branchesBasic - via gh CLI
StatusActive (generally available/public preview)End-of-life: October 25, 2025
ArchitectureStandalone Node.js applicationExtension on the gh CLI

The fundamental distinction is philosophical: the old extension was a command suggester (proposes a shell command for the user to copy and run), while the new Copilot CLI is an agentic executor (understands goals, plans, and carries out the necessary commands and code changes itself).

What is the key architectural difference between the deprecated gh copilot extension and the new GitHub Copilot CLI?
What was the end-of-life date for the deprecated gh copilot extension?

2. What are the prerequisites for installing GitHub Copilot CLI?

Before installing Copilot CLI you must have the correct runtime environment, a valid Copilot subscription, and (if working within an organisation) the right admin policy enabled.

Prerequisites
RequirementDetail
Node.js runtimeNode.js 22 or later must be installed
GitHub Copilot subscriptionAny Copilot plan: Free, Pro, Pro+, Max, Business, or Enterprise
Organisation policyIf Copilot access comes through an organisation, the org admin must enable the 'Copilot CLI' policy in GitHub settings
Operating systemmacOS, Linux, or Windows
Internet connectionRequired for authentication and AI inference

Organisation policy note: even if a user has a valid Copilot licence through their organisation, the CLI will not work if the organisation owner or enterprise administrator has disabled the Copilot CLI policy. This is a separate toggle from general Copilot access.

Copilot plans that include CLI: Copilot CLI is included as a core feature of all GitHub Copilot plans - there is no additional billing beyond the existing plan's AI Credits allowance.

What is the minimum Node.js version required to install GitHub Copilot CLI?
If a developer has a Copilot Business licence but their organisation admin has disabled the Copilot CLI policy, can they use Copilot CLI?

3. How do you install GitHub Copilot CLI?

Copilot CLI can be installed through several methods depending on your operating system and preferences.

Installation methods
MethodCommandOS
npm (recommended)npm install -g @github/copilotmacOS, Linux, Windows
Install script (root)curl -fsSL https://github.com/github/copilot-cli/releases/latest/download/install.sh | sudo bashmacOS, Linux
Install script (user)curl -fsSL https://github.com/github/copilot-cli/releases/latest/download/install.sh | bashmacOS, Linux
Homebrewbrew install gh-copilot (check docs for current formula)macOS
WinGetwinget install GitHub.CopilotCLIWindows
# npm installation (most common)
npm install -g @github/copilot

# Verify installation
copilot --version

# Install a specific version (using install script)
curl -fsSL .../install.sh | VERSION=1.2.3 bash

# Install to a custom directory (using install script)
curl -fsSL .../install.sh | PREFIX=$HOME/.local bash
# Installs to $HOME/.local/bin/

Install script options: The shell install script supports VERSION to pin a specific version and PREFIX to change the install directory. By default it installs to /usr/local/bin/ when run as root, or $HOME/.local/bin/ when run as a non-root user.

What is the npm command to install GitHub Copilot CLI globally?
What environment variable controls the install directory when using the Copilot CLI shell install script?

4. How do you authenticate GitHub Copilot CLI and what token types are supported?

Copilot CLI supports two authentication methods: an interactive browser-based flow (default) and a token-based flow for headless/automated environments.

Authentication methods
MethodHow it worksBest for
Browser-based (default)Run copilot or /login - browser opens for OAuth flow; token stored in system credential storeInteractive use on developer machines
Environment variable tokenSet COPILOT_GITHUB_TOKEN, GH_TOKEN, or GITHUB_TOKEN env varHeadless automation, CI/CD, scripts
# Method 1: Interactive browser flow (first time use)
copilot
# → prompted to /login if not authenticated
# Follow on-screen browser authentication

# Method 2: Fine-grained PAT in environment variable
export COPILOT_GITHUB_TOKEN=github_pat_xxx
copilot -p "List my open issues"

# Method 3: Use GH_TOKEN or GITHUB_TOKEN (checked in order)
export GH_TOKEN=your_token_here
copilot -p "Explain this code"

Token type precedence (checked in order): COPILOT_GITHUB_TOKENGH_TOKENGITHUB_TOKEN.

Supported token types:

  • Fine-grained personal access tokens (v2 PATs) with the Copilot Requests permission
  • OAuth tokens from the Copilot CLI app
  • OAuth tokens from the GitHub CLI (gh) app
  • Classic personal access tokens (ghp_) are NOT supported

When no credential store is found, the token is saved as plain text in ~/.copilot/ (or the path set by COPILOT_HOME).

Which token type is NOT supported for authenticating GitHub Copilot CLI?
In what order does Copilot CLI check environment variables for an authentication token?

5. What is the directory trust model in GitHub Copilot CLI and why does it exist?

Copilot CLI has the ability to read, modify, and execute files in your working directory - which poses a security risk if you run it in an untrusted location (e.g. a directory containing malicious files). The directory trust model requires you to explicitly confirm trust before Copilot can act on files.

When you run copilot in a directory for the first time, you are presented with a trust prompt with three options:

Trust prompt options
OptionEffect
1. NoCopilot CLI exits - no files in this directory are accessed
2. Yes, for this session onlyCopilot can work with files in this folder for the current session only - asked again next time
3. Yes, and remember this folderCopilot trusts this folder permanently for all future sessions - not asked again when starting from this folder
# Starting Copilot CLI in a directory for the first time:
$ copilot
During this GitHub Copilot CLI session, Copilot may attempt to
read, modify, and execute files in and below this folder.
Do you trust the files in this folder?
> 1. No
  2. Yes, for this session only
  3. Yes, and remember this folder for future sessions

Why it matters: if you navigate into a directory containing maliciously crafted files and run Copilot CLI, those files could potentially influence the AI to execute harmful commands. The trust model ensures you consciously acknowledge the risk before granting Copilot file access.

What happens if you select 'No' at the Copilot CLI directory trust prompt?
What does selecting 'Yes, and remember this folder' at the trust prompt do?

6. How do you start an interactive Copilot CLI session and what are the two main usage modes?

Copilot CLI has two usage modes: an interactive session (the default) and a non-interactive / programmatic mode using the -p flag.

# Mode 1: Interactive session
cd my-project
copilot
# → trust prompt → REPL-style interface opens
# Type prompts, use slash commands, use keyboard shortcuts

# Mode 2: Non-interactive / single prompt
copilot -p "How do I undo a git commit without losing changes?"
# → prints the answer and exits

# Mode 2 with silent output (response only, no extra info)
copilot -p "Explain git rebase" -s

# Use -p in scripts for AI-powered automation
SUMMARY=$(copilot -p "Summarise the changes in git diff HEAD~1" -s)
echo "$SUMMARY"

Mode comparison
ModeCommandUse case
InteractivecopilotOngoing coding sessions, multi-turn conversations, task execution
Non-interactivecopilot -p "prompt"Scripts, automation, one-off questions, CI/CD integration
Silent non-interactivecopilot -p "prompt" -sCapture only the AI response in a shell variable

Inside an interactive session: you can type natural language prompts, use slash commands (e.g. /help, /model, /pr), use keyboard shortcuts (e.g. Shift+Tab to cycle between modes), and browse GitHub tabs - all without leaving the terminal.

What flag allows you to use GitHub Copilot CLI non-interactively from a shell script?
What does the -s flag add to a non-interactive Copilot CLI call?

7. What are slash commands in GitHub Copilot CLI and what are the most important ones?

Slash commands are special instructions you type inside an interactive Copilot CLI session (prefixed with /) to control behaviour, switch context, or trigger specific actions.

Key slash commands
CommandPurpose
/? or /helpList all available slash commands and keyboard shortcuts
/loginAuthenticate with your GitHub account
/logoutSign out of GitHub
/modelView or change the AI model for the current session
/model autoLet Copilot pick the best available model automatically
/initGenerate or update a copilot-instructions.md file for the repo
/init suppressPermanently hide the 'no instructions found' startup message for this repo
/prView, create, and fix pull requests from the terminal
/fleetSpawn subagents to speed up multi-step implementation plans
/delegateAsk Copilot to work autonomously on a task (similar to autopilot)
/chronicleQuery session history, get standup reports, usage insights
/experimental showEnable access to experimental/preview features
/mcpManage MCP (Model Context Protocol) server connections
# Inside an interactive session:
/help                   # show all commands
/model                  # list available models
/model claude-3-7-sonnet # switch to a specific model
/model auto             # let Copilot auto-select
/init                   # generate copilot-instructions.md
/pr                     # open PR management interface
/chronicle              # session history insights

What slash command generates a copilot-instructions.md file for the current repository?
What does the /chronicle slash command do in Copilot CLI?

8. What are the operating modes in GitHub Copilot CLI and how do you switch between them?

Copilot CLI has three operating modes that control how autonomously the agent works. You cycle between them using Shift+Tab.

Copilot CLI operating modes
ModeBehaviourWhen to use
Chat (default)Conversational mode - answers questions, explains code, discusses approaches without executing commandsGeneral Q&A, planning, getting advice
PlanCopilot outlines a step-by-step plan for a task before executing anything - you can review and adjust the planComplex tasks where you want to verify the approach before Copilot acts
AutopilotCopilot works autonomously until the task is complete without asking for step-by-step approval - it continues on its own after each stepDelegated tasks where you trust Copilot to handle the full implementation
# Keyboard shortcut: Shift+Tab to cycle through modes
# Chat → Plan → Autopilot → Chat → ...

# You can also trigger via command
/delegate  # switches to autopilot-style autonomous execution

# Launch with experimental flag to access all modes
copilot --experimental
# Then use /experimental show to see available preview features

Autopilot mode is one of the most powerful features - it encourages the agent to continue working until a task is fully completed without requiring human approval at each step. It is recommended for well-defined tasks where you have high confidence in the AI's direction.

Note: Autopilot mode requires the experimental features flag to be enabled. Once activated, the setting persists in your config so you don't need --experimental on subsequent launches.

How do you cycle between Chat, Plan, and Autopilot modes in GitHub Copilot CLI?
What is the key behaviour difference of Autopilot mode compared to Plan mode?

9. What is the copilot-instructions.md file and how does it affect Copilot CLI behaviour?

The copilot-instructions.md file is a repository-level configuration file that provides Copilot with persistent custom instructions about your project - such as build commands, test procedures, architecture notes, and coding conventions. Copilot CLI reads this file automatically on startup.

# Generate copilot-instructions.md for your project
/init
# Copilot scans the repo and proposes content covering:
# - Build, test, and lint commands
# - High-level architecture overview
# - Conventions and project-specific notes

# If the file already exists, /init suggests improvements
# You can accept or reject individual suggestions

# Suppress the startup message if you don't want the file
/init suppress

# Example copilot-instructions.md content:
# ## Build
# npm run build
#
# ## Test
# npm test
#
# ## Architecture
# This is a React frontend with a Node.js Express backend...

What it typically documents:

  • Build, test, and lint commands
  • High-level architecture description
  • Key directories and their purpose
  • Coding conventions and style guidelines
  • Deployment notes

Startup behaviour: if no copilot-instructions.md is found, Copilot CLI displays: 💡 No copilot instructions found. Run /init to generate a copilot-instructions.md file for this project. You can permanently suppress this message with /init suppress.

What slash command generates or updates the copilot-instructions.md file by scanning your repository?
What information does copilot-instructions.md typically contain?

10. How does model selection work in GitHub Copilot CLI?

Copilot CLI supports multiple AI models and provides several ways to select or switch models - at launch, during a session, or automatically.

# Select a model at launch with --model flag
copilot --model claude-3-7-sonnet

# Use auto to let Copilot pick the best available model
copilot --model auto

# Or set via environment variable
export COPILOT_MODEL=gpt-4o
copilot

# Switch model during an interactive session
/model                        # list available models
/model gpt-4o                 # switch to a specific model
/model auto                   # switch to auto-selection

# /model is also useful for comparing approaches:
# Run the same prompt with different models to see
# which handles your use case better

Auto model selection: passing auto lets Copilot automatically pick the best available model for each task. This is the recommended setting if you don't have a specific preference, as Copilot can route different request types to the most appropriate model.

Available models depend on your Copilot plan. Higher-tier plans (Business, Enterprise, Pro+, Max) have access to a wider range of models. Use /model inside a session to see which models are currently available to your account.

What does passing --model auto to Copilot CLI do?
How do you change the AI model during an active interactive Copilot CLI session?

11. What is the /pr slash command in GitHub Copilot CLI and what can it do?

The /pr slash command lets you manage GitHub pull requests directly from the terminal without switching to a browser or using the gh CLI separately.

/pr capabilities
ActionDescription
View PRsBrowse open pull requests in the current repository
Create PROpen a pull request from the current branch with an AI-generated description
Fix PRAsk Copilot to address review comments or CI failures on an existing PR
Review PRGet AI-generated code review suggestions for a PR
Create branch + PR in one commandcopilot lets you implement a change and open a PR with a single natural language request
# Inside an interactive Copilot CLI session:
/pr                         # browse and manage PRs

# One-command branch + implement + PR workflow:
# "Create a branch, add input validation to the login form, and open a PR"
# → Copilot creates the branch, makes the code change, opens the PR

# Fix review comments on an existing PR:
/pr
# → navigate to the PR → ask Copilot to address feedback

# Non-interactive: create PR from current branch
copilot -p "Create a pull request for the current branch with a summary of changes" -s

Branch protections and policies: Copilot CLI respects your repository's branch protection rules, required status checks, and organisation policies - it cannot bypass these even when creating PRs autonomously. Copilot Business or Enterprise settings apply automatically.

What does the /pr slash command allow you to do in Copilot CLI?
Does GitHub Copilot CLI bypass branch protection rules when creating pull requests?

12. What is the /fleet slash command and what problem does it solve?

The /fleet command allows Copilot CLI to spawn multiple subagents that work in parallel on different parts of a complex implementation plan. This dramatically speeds up multi-step tasks that would otherwise need to be executed sequentially.

# Example: implement a feature with multiple independent components
/fleet
# Copilot divides the work into parallel sub-tasks:
# Subagent 1: Update the database schema
# Subagent 2: Write unit tests
# Subagent 3: Update API documentation
# All run simultaneously - dramatically faster than sequential

# You can monitor progress from GitHub.com or mobile
# while /fleet coordinates the subagents in the background

How /fleet works:

  • Copilot analyses your task and identifies parts that can be worked on in parallel
  • It spawns subagents, each with their own context and tool access
  • Results are coordinated and merged
  • You stay in control - you can monitor, steer, and merge from GitHub.com or GitHub Mobile

Typical use case: large features that span multiple files or subsystems - e.g. adding a new API endpoint (requires schema change + controller + tests + docs). Without fleet, Copilot does these sequentially; with fleet, they run in parallel.

What is the primary benefit of using the /fleet command in GitHub Copilot CLI?
While /fleet is coordinating subagents in the background, from where can you monitor and steer the work?

13. What is remote control in GitHub Copilot CLI and how does it work?

Remote control allows you to monitor and interact with a running Copilot CLI session from GitHub.com or GitHub Mobile, even after you have stepped away from your terminal.

# Enable remote control when starting a session
copilot --remote

# Or connect to an existing task by ID
copilot --remote --resume TASK-ID

# Remote export (share output remotely without full session control)
copilot --remote-export

# Connect to a specific remote session
copilot --connect

Remote control use cases:

  • Start a long-running task on your laptop, walk away, monitor progress on your phone
  • Respond to Copilot's questions or approve steps from GitHub.com without returning to the terminal
  • Hand off a session to a colleague who can continue it from GitHub.com
  • Resume a remote task locally - works even if the task was originally created outside a Git repository

Requirements: the remote sessions feature must be available on your account. The --remote, --no-remote, --remote-export, --no-remote-export, and --connect options all require this feature.

What does enabling remote control in Copilot CLI allow you to do?
Can you resume a remote Copilot CLI task locally if the original task was started outside a Git repository?

14. What are Copilot CLI hooks and what can they be used for?

Hooks are user-defined scripts that Copilot CLI invokes automatically at specific points during a session - for example, before or after Copilot modifies files. They let you inject custom logic (validation, notifications, formatting) into the Copilot workflow without modifying the agent's core behaviour.

Hook characteristics
AspectDetail
ConfigurationDefined in the Copilot CLI config or a hooks configuration file
Hook eventsPre-task, post-task, pre-file-write, post-file-write, and others depending on the version
Input payloadHooks receive a JSON payload describing the current action
Decision controlHooks can allow, block, or modify Copilot's planned actions
Use casesAuto-format code after edits, run linters, send Slack notifications, enforce security policies
# Example hook: run prettier after every file write
# hooks config (format may vary - check docs for current schema)
hooks:
  post-file-write:
    - command: "npx prettier --write {file}"
      description: "Auto-format after Copilot edits"

# Example hook: block writes to sensitive paths
# A hook can inspect the planned file path and return
# a decision to allow or deny the write

For detailed information about hooks - including configuration formats, supported events, input payloads, and decision control - see the GitHub Copilot hooks reference in the official documentation.

What is the main purpose of hooks in GitHub Copilot CLI?
What type of control can hooks exercise over Copilot's planned actions?

15. What is the AGENTS.md file and how does it differ from copilot-instructions.md?

Both files customise how Copilot behaves in a repository, but they serve different purposes and have different scopes.

AGENTS.md vs copilot-instructions.md
FeatureAGENTS.mdcopilot-instructions.md
PurposeDefine custom instructions and tool access for agentic sessions - used by Copilot when working autonomouslyProvide project context: build commands, architecture, conventions for all Copilot interactions
ScopeAgentic/autonomous sessions (Plan, Autopilot, /fleet)All Copilot CLI sessions including chat
ContentsAgent behaviour rules, which skills/tools are permitted, task-specific instructionsBuild commands, test commands, architecture overview, coding style
Cross-session consistencyEnsures behaviour stays consistent across models, sessions, and delegated workEnsures Copilot has project context on every session
Generated byCreated manually or by /init for agent-specific needsGenerated or updated by /init

When to use each:

  • Use copilot-instructions.md to give Copilot general project knowledge that applies to all interactions (how to build, test, understand the codebase)
  • Use AGENTS.md to define the rules and constraints for autonomous agent sessions specifically - what tools an agent can use, what actions it should or shouldn't take, task-specific behavioural guidelines
What is the primary purpose of the AGENTS.md file in a repository?
Which file would you primarily use to specify your project's build and test commands for Copilot?

16. What is the /chronicle slash command and what session history features does it provide?

The /chronicle command gives you access to a searchable history of all your Copilot CLI sessions. Instead of losing context between sessions, Copilot builds a persistent record that you can query in natural language.

/chronicle capabilities
FeatureDescription
Session history searchQuery past sessions using natural language - e.g. 'find the session where I fixed the auth bug'
Standup reportsGenerate a summary of what you worked on yesterday or this week
Personalised tipsGet suggestions based on patterns in your CLI usage history
Resume previous workIdentify a past session and pick up where you left off
Usage insightsUnderstand which models, commands, and workflows you use most
# Inside an interactive Copilot CLI session:
/chronicle
# → opens session history interface

# Example queries inside /chronicle:
"What did I work on yesterday?"
"Find the session where I added pagination to the API"
"Generate a standup report for this week"
"Show me tips based on how I've been using Copilot"

# Resume a specific past session
copilot --resume SESSION-ID

Why it matters: developer context is often lost between terminal sessions. /chronicle makes your AI-assisted work history queryable and actionable - turning session logs from a passive record into an active productivity tool. You can generate daily standup notes in seconds rather than reconstructing what you did from git logs.

What can you use the /chronicle command to generate automatically?
How does Copilot CLI's /chronicle feature improve on traditional terminal history?

17. What is MCP (Model Context Protocol) support in Copilot CLI and how do you use it?

Model Context Protocol (MCP) is an open standard that allows AI models to connect to external tools and data sources through a standardised interface. Copilot CLI supports MCP via the /mcp slash command, allowing you to extend it with a rich ecosystem of third-party integrations.

# Manage MCP server connections inside a Copilot CLI session
/mcp                          # view connected MCP servers
/mcp add <server-name>        # connect a new MCP server
/mcp remove <server-name>     # disconnect an MCP server

# GitHub's own native MCP server
# /mcp includes github - lets Copilot work with:
# - Issues and pull requests
# - Branches and commits
# - Repository metadata
# All through the MCP protocol

Why MCP matters: without MCP, Copilot CLI's tool access is limited to local file system, shell, and GitHub.com. With MCP servers you can connect Copilot to:

  • Databases (query schema, run migrations)
  • Monitoring tools (query logs, dashboards)
  • Issue trackers (Jira, Linear)
  • Cloud providers (AWS, GCP tools)
  • Community-built integrations

GitHub's native MCP server is built in and lets Copilot work with GitHub issues, branches, and pull requests programmatically - not just through file edits. This is described as the preferred way to interact with GitHub resources in Copilot CLI.

What is the purpose of MCP (Model Context Protocol) support in GitHub Copilot CLI?
Which slash command is used to manage MCP server connections inside a Copilot CLI session?

18. What is the COPILOT_HOME environment variable and where does Copilot CLI store its config?

Copilot CLI stores configuration, cached data, and authentication tokens in a dedicated directory. By default this is ~/.copilot/ but you can override the location with the COPILOT_HOME environment variable.

Copilot CLI config storage
ItemDefault locationOverride
Config directory~/.copilot/Set COPILOT_HOME=/path/to/dir
Auth token (no credential store)~/.copilot/ (plain text)Avoided if system credential store available
Trusted directories listStored in config directoryN/A
Session historyStored in config directoryN/A
MDM configurationSystem-managed pathRefer to GitHub Copilot CLI configuration directory docs
# Override the config directory location
export COPILOT_HOME=/custom/path/.copilot
copilot

# COPILOT_HOME is useful for:
# - Running multiple Copilot CLI instances with separate configs
# - Storing config in a non-home directory (e.g. shared CI environment)
# - Pointing to a network-mounted config for team consistency
# - Isolating config in containerised/ephemeral environments

# Default credential storage preference:
# 1. System credential store (keychain on macOS, etc.) - most secure
# 2. Plain text ~/.copilot/config - fallback if no credential store found

Security note: Copilot CLI prefers the system credential store (macOS Keychain, Windows Credential Manager, etc.) for token storage. If no credential store is detected, it falls back to a plain text file in the config directory - this is less secure and Anthropic recommends ensuring a credential store is available on developer machines.

What environment variable overrides the default ~/.copilot/ configuration directory in Copilot CLI?
What happens to the authentication token if Copilot CLI cannot find a system credential store?

19. What are experimental features in Copilot CLI and how do you enable them?

Copilot CLI has a set of preview/experimental features that are not enabled by default. These are features GitHub is actively developing and may change based on feedback. Enabling experimental features unlocks capabilities before they reach general availability.

# Method 1: Launch with the --experimental flag
copilot --experimental

# Once activated, the setting persists in config
# Subsequent launches do NOT need --experimental

# Method 2: Use the slash command inside a session
/experimental show
# → displays and enables available experimental features

# Check what experimental features are currently available
/experimental show
# Lists current preview features you can opt into

Key experimental feature - Autopilot mode: autopilot is introduced as an experimental feature (press Shift+Tab to cycle to it). Once you have enabled experimental features, autopilot persists as an available mode.

Important: experimental features are subject to change, may be incomplete, and could be removed or significantly altered before reaching GA. They are best suited for personal developer machines rather than production workflows.

After enabling experimental features with --experimental, do you need to pass this flag on every subsequent Copilot CLI launch?
Which slash command lets you view and enable experimental features from within an active Copilot CLI session?

20. What is AI Credits billing in GitHub Copilot CLI and how does it work?

GitHub Copilot CLI draws on your plan's AI Credits allowance rather than being charged separately. Every interaction with the agent - submitting a prompt - reduces your monthly AI Credits quota by one premium request.

AI Credits and Copilot CLI billing
AspectDetail
Billing modelIncluded in all Copilot plans - no additional subscription needed
Cost per interactionEach prompt submitted to Copilot CLI reduces your monthly premium request quota by one
Plan differencesHigher plans (Pro+, Max, Business, Enterprise) have larger premium request allowances
OverageIf you exceed your allowance, behaviour depends on your plan (blocked or billed at overage rate)
Tool calls within a sessionTool calls within a single agent turn may count differently - check current docs

Copilot CLI is included in all Copilot plans: Free, Pro, Pro+, Max, Business, and Enterprise. There is no separate CLI subscription. The CLI competes for the same AI Credits pool as other Copilot features (chat, code completion, etc.).

Practical tip: long agentic sessions with many tool calls and back-and-forth exchanges consume more AI Credits than short Q&A prompts. Monitor your usage in GitHub settings if you are on a plan with limited premium requests.

How is GitHub Copilot CLI billed relative to your Copilot subscription?
Which GitHub Copilot plans include access to Copilot CLI?

21. How does Copilot CLI read and understand repository context?

Copilot CLI builds its understanding of your codebase from several sources - the directory you run it in, the files it reads during a session, project configuration files, and the copilot-instructions.md file.

Context sources for Copilot CLI
SourceWhat Copilot learns
copilot-instructions.mdBuild commands, test procedures, architecture overview, conventions
AGENTS.mdAgent behavioural rules, tool permissions for autonomous sessions
Directory structureProject layout, frameworks, languages in use
Files read during sessionFull content of files explicitly opened or referenced in the task
Git history and diffsRecent changes, branch context, commit messages
GitHub.com dataIssues, PRs, CI results - accessed via native GitHub integration or MCP
# Copilot CLI reads context progressively during a session
# It does NOT index the entire codebase upfront

# To give Copilot specific context:
"Look at src/auth/login.ts and explain the authentication flow"
# → Copilot reads that file and builds context from it

# For large codebases, guide Copilot to the relevant files:
"The bug is in the payment processing module in src/payments/"
# → Copilot narrows its file reading to that directory

# copilot-instructions.md reduces the need for repeated context:
# Instead of explaining your stack every session, put it in the file

Context limits: like all LLM-based tools, Copilot CLI has a context window limit. For very large files or repositories, it reads selectively. Providing clear, targeted prompts and maintaining a well-written copilot-instructions.md reduces the risk of Copilot operating with incomplete context.

What is the recommended file for providing Copilot CLI with persistent project context like build commands and architecture notes?
Does Copilot CLI index the entire codebase upfront when you start a session?

22. What are the keyboard shortcuts available in an interactive Copilot CLI session?

Copilot CLI provides keyboard shortcuts that speed up navigation and mode switching inside an interactive session, reducing the need to type slash commands for common operations.

Key keyboard shortcuts
ShortcutAction
Shift+TabCycle between Chat, Plan, and Autopilot modes
EnterSubmit current prompt
Ctrl+CCancel the current Copilot action or exit the session
Up / Down arrowNavigate through prompt history (previous prompts in the session
TabAutocomplete slash command names
/? or /helpList all available commands and shortcuts
# Starting an interactive session to practice shortcuts
copilot

# → Shift+Tab to cycle modes:
# [Chat] → [Plan] → [Autopilot] → [Chat] → ...

# → Type /? to see all shortcuts
# → Use Up arrow to recall previous prompts
# → Press Tab after / to autocomplete slash commands

# Key workflow tip:
# Start in Chat to discuss approach
# Shift+Tab to Plan to review the plan before execution
# Shift+Tab to Autopilot to let Copilot run it autonomously

Most important shortcut - Shift+Tab: this is the primary way to switch modes without typing a command. Mastering when to use Chat vs Plan vs Autopilot via Shift+Tab is one of the most impactful productivity skills for Copilot CLI power users.

What keyboard shortcut cycles between Chat, Plan, and Autopilot modes in a Copilot CLI interactive session?
What happens when you press Ctrl+C during an active Copilot CLI action?

23. What is the difference between GitHub Copilot CLI and Copilot in VS Code?

Both are AI coding assistants powered by GitHub Copilot, but they target different workflows and environments.

Copilot CLI vs Copilot in VS Code
DimensionGitHub Copilot CLIGitHub Copilot in VS Code
InterfaceTerminal / command lineIDE (graphical editor)
Primary strengthAgentic task execution - multi-step, multi-file autonomous workInline completions, chat in editor, code actions at the cursor
File handlingReads and writes files via shell and bash toolEdits files via VS Code's editor API
GitHub integrationNative - issues, PRs, branches via /pr and MCPVia GitHub Pull Requests extension
Offline capabilityNo - requires API connectionNo - requires API connection
Best forDevOps tasks, refactoring, feature implementation, CI workflowsInline code completion, quick edits, chat about specific code
BillingShared AI Credits poolSame shared AI Credits pool

Complementary tools: Copilot CLI and Copilot in VS Code are not competitors - they complement each other. A typical workflow might use VS Code Copilot for active editing and inline suggestions, then switch to Copilot CLI for larger, autonomous tasks like refactoring a module or setting up a CI/CD pipeline.

What is the primary strength of GitHub Copilot CLI compared to Copilot in VS Code?
Do GitHub Copilot CLI and Copilot in VS Code draw from the same AI Credits pool?

24. What is GitHub Copilot Workspace and how does it differ from Copilot CLI?

GitHub Copilot Workspace is a browser-based, GitHub-native environment for planning and executing larger tasks driven by issues and pull requests. It is distinct from Copilot CLI, which is terminal-native.

Copilot CLI vs Copilot Workspace
DimensionCopilot CLICopilot Workspace
InterfaceTerminalGitHub.com browser interface
Entry pointA task or natural language prompt in the terminalA GitHub issue or pull request
Execution environmentYour local machine (files, shell)GitHub-managed cloud environment
Agentic capabilityYes - autopilot, fleet, hooksYes - multi-step planning and coding from issue to PR
Best forLocal development, DevOps, CI integrationIssue-driven feature development, reviewing and implementing GitHub tasks
Requires local setupYes - Node.js 22+, authNo - runs entirely in the browser on GitHub.com

Key distinction: Copilot CLI operates on your local machine and is best for terminal-centric workflows. Copilot Workspace operates entirely within GitHub.com and is driven by GitHub issues - you can go from a bug report or feature request to an open pull request without leaving the browser.

What is the primary entry point for starting work in GitHub Copilot Workspace?
Which tool requires a local machine with Node.js installed - Copilot CLI or Copilot Workspace?

25. What are common Copilot CLI troubleshooting steps and how do you debug issues?

When Copilot CLI behaves unexpectedly - authentication errors, tool failures, or unexpected responses - a structured set of checks resolves most issues.

Common issues and fixes
SymptomLikely causeFix
'Not authenticated' errorNo valid token foundRun copilot and complete /login, or set COPILOT_GITHUB_TOKEN
'Organisation policy' errorCLI not enabled for your orgAsk org admin to enable Copilot CLI in org settings
Classic PAT rejectedghp_ tokens are not supportedUse a fine-grained PAT with Copilot Requests permission
Copilot ignores project contextNo copilot-instructions.mdRun /init to generate the file
Session crashes on large repoContext window exceededUse targeted prompts; guide Copilot to specific files
Trust prompt on every launch'Yes for this session' selectedReselect 'Yes, remember this folder' to persist trust
/mcp server not connectingMCP server config incorrectCheck /mcp and review server connection settings
Outdated model / responses seem offOld version of Copilot CLInpm update -g @github/copilot
# Common diagnostic commands
copilot --version               # check installed version
copilot -p "hello" -s           # quick test of auth + model

# Update Copilot CLI
npm update -g @github/copilot

# Re-authenticate
copilot
/logout
/login

# Check which token is being used
echo $COPILOT_GITHUB_TOKEN
echo $GH_TOKEN

For persistent issues, GitHub's Copilot CLI documentation includes a dedicated troubleshooting section, and you can open GitHub Support tickets for plan or policy-related authentication failures.

What is the correct way to update GitHub Copilot CLI to the latest version when installed via npm?
A developer gets an authentication error despite having a Copilot subscription. Which token type issue is most likely the cause?

26. How does Copilot CLI differ between Copilot Individual, Business, and Enterprise plans?

All Copilot plans include access to Copilot CLI, but the plans differ in available models, premium request limits, and administrative controls.

Copilot CLI features by plan
FeatureFree / ProPro+ / MaxBusinessEnterprise
Copilot CLI accessYesYesYesYes
Model selectionLimitedWider selectionWider selectionWidest selection
Monthly AI CreditsLower allowanceHigher allowancePer-seat allowancePer-seat allowance (highest)
Organisation policy controlsN/AN/AAdmin can enable/disable CLIAdmin can enable/disable CLI
Audit logs for CLI usageNoNoYesYes
IP indemnificationNoNoYesYes
Data excluded from trainingNoNoYes (promptless)Yes (promptless)

Data privacy note: for Business and Enterprise plans, prompts and completions are not used to train GitHub or OpenAI models by default. For Free and Pro plans, data may be used for model improvement unless you opt out in GitHub settings.

Policy controls: only Business and Enterprise org admins can enable or disable the Copilot CLI policy for their organisations. Individual plan users are not subject to org-level restrictions (unless they are also members of a Business/Enterprise org that restricts CLI).

Which Copilot plans allow organisation administrators to enable or disable the Copilot CLI policy?
On which Copilot plans are prompts NOT used to train GitHub or OpenAI models by default?

27. How do you use Copilot CLI effectively with private repositories?

Copilot CLI works with private repositories the same way it works with public ones - the local file system access means it reads private files directly without sending them to GitHub. However, when using GitHub-integrated features like /pr or MCP, your token must have the appropriate private repository permissions.

# Working with a private repository is straightforward:
git clone https://github.com/myorg/private-repo.git
cd private-repo
copilot
# → Trust prompt → session starts with access to all local files

# Copilot reads your private code locally - it doesn't
# upload your entire repo to GitHub to enable CLI features

# For /pr on a private repo, your token needs:
# - repo scope (classic PAT) OR
# - Contents: read + Pull requests: write (fine-grained PAT)

# Fine-grained PAT setup for private org repo:
export COPILOT_GITHUB_TOKEN=github_pat_xxx
# Token needs: Copilot Requests + Contents (read) + Pull requests (write)
# for full CLI + PR functionality on private repos

Security considerations for private repos:

  • Copilot CLI reads private files locally - the content it reads for local tasks stays in your AI inference session and is governed by your plan's data policy
  • For Business/Enterprise plans, private code is not used for training
  • Prompts containing private code snippets are governed by GitHub's data handling policies
  • The trust prompt is especially important in private repos - ensure only authorised users can start Copilot sessions in sensitive directories
When Copilot CLI reads files from a private repository for a local task, where does it read them from?
What permission does a fine-grained PAT need to create pull requests on a private repository via Copilot CLI's /pr command?

28. What are best practices for writing effective prompts in GitHub Copilot CLI?

The quality of Copilot CLI's output is directly related to the clarity and specificity of your prompt. Well-structured prompts reduce back-and-forth and get you to working code faster.

Prompt writing principles
PrincipleExample
Specify the task clearly'Add input validation to the email field in src/forms/signup.tsx - reject addresses without @ and a domain'
Include the context path'Look at src/api/auth.ts and add rate limiting to the /login endpoint'
Mention constraints'Add the feature without modifying existing tests'
Describe the expected outcome'The result should pass all existing tests and add new tests for the validation logic'
Break large tasks into phasesUse Plan mode to review a step-by-step plan before Autopilot executes it
# Vague prompt (avoid)
"Fix the bug"

# Better prompt
"The login form throws a TypeError when the email field is empty.
Fix the bug in src/components/LoginForm.tsx - the issue
is in the handleSubmit function around line 45."

# Best prompt for complex task - use Plan mode
# Shift+Tab to Plan mode, then:
"Refactor the payment processing module in src/payments/ to use
the new Stripe SDK v5 API. The old SDK used client.charges.create();
the new SDK uses client.paymentIntents.create(). Preserve all
existing error handling and update the relevant unit tests."
# → Copilot produces a plan for review before executing

Pro tip - use Plan mode for risky changes: before letting Copilot execute a significant refactor or delete files, switch to Plan mode (Shift+Tab) and review the proposed steps. This catches misunderstandings before they cause unintended changes.

What is the most important quality of an effective Copilot CLI prompt?
Why is it recommended to use Plan mode before executing large refactoring tasks in Copilot CLI?

29. How can you use GitHub Copilot CLI in CI/CD pipelines and automation workflows?

Copilot CLI's non-interactive mode (-p) and environment variable authentication make it suitable for use in CI/CD pipelines, GitHub Actions, and shell scripts - enabling AI-powered automation at scale.

# GitHub Actions example: AI-powered PR summary on every PR
name: Copilot PR Summary
on:
  pull_request:
    types: [opened]
jobs:
  summarise:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: "22"
      - run: npm install -g @github/copilot
      - name: Generate PR summary
        env:
          COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_TOKEN }}
        run: |
          SUMMARY=$(copilot -p "Summarise the changes in this diff for a PR description" -s)
          echo "$SUMMARY" >> $GITHUB_STEP_SUMMARY

# Shell script: AI-powered code review check
#!/bin/bash
export COPILOT_GITHUB_TOKEN="$COPILOT_TOKEN"
REVIEW=$(copilot -p "Review the changes in git diff HEAD~1 for security issues" -s)
if echo "$REVIEW" | grep -qi "security concern"; then
  echo "Security review flagged issues:"
  echo "$REVIEW"
  exit 1
fi

CI/CD best practices with Copilot CLI:

  • Always use environment variable authentication - never hardcode tokens
  • Store the token as an encrypted secret in your CI system
  • Use -s (silent) flag to capture clean output for downstream processing
  • Trust prompts do not appear in non-interactive mode - CI environments are automatically trusted
  • Use fine-grained PATs with minimum required permissions
Which flag is essential when using Copilot CLI in a shell script to capture only the AI response without extra output?
How should the Copilot authentication token be provided in a CI/CD pipeline?

30. What security considerations should developers be aware of when using GitHub Copilot CLI?

Copilot CLI is a powerful agentic tool that can read, modify, and execute code. This power introduces security considerations that every developer and organisation should understand before adopting it.

Security considerations
RiskMitigation
Malicious files in untrusted directoriesUse the directory trust model - never select 'Yes' in untrusted or downloaded directories without inspection
Prompt injection via file contentsBe cautious with repos from unknown sources - malicious files can contain instructions that try to hijack Copilot's actions
Token securityUse fine-grained PATs with minimum permissions; rotate tokens regularly; store in system credential store
Data privacyBusiness/Enterprise plans exclude data from training; Free/Pro users should review GitHub's data usage settings
Runaway agent actionsUse Plan mode to review before Autopilot executes risky changes; Ctrl+C to stop at any time
CI/CD secret exposureNever log COPILOT_GITHUB_TOKEN; use encrypted secrets in CI systems
Scope of file accessCopilot only accesses files in and below the trusted directory - structure your repos accordingly

Prompt injection warning: if you run Copilot CLI in a directory containing adversarially crafted files (e.g. a malicious repository), those files could contain embedded instructions designed to make Copilot take unintended actions. The directory trust model is the primary defence - only trust directories you control and have inspected.

What is the primary defence in GitHub Copilot CLI against prompt injection attacks via malicious repository files?
If a Copilot CLI session in Autopilot mode starts taking unexpected actions, what is the fastest way to stop it?

31. What is the --delegate flag and how does the /delegate slash command work?

The /delegate slash command and --delegate flag allow you to hand off a task to Copilot for fully autonomous execution - similar to Autopilot mode but often used to initiate a delegation from the command line or during a session when you want to step away entirely.

# Delegate a task from the command line
copilot --delegate "Implement pagination for the /api/users endpoint,
add tests, and open a pull request when done"

# Inside an interactive session:
/delegate
# → Copilot switches to full autonomous execution
# → You can monitor from GitHub.com or GitHub Mobile
# → Use --remote to enable remote monitoring alongside delegation

# Combine delegation with remote control:
copilot --delegate "Refactor the payment module" --remote
# → Task runs autonomously AND you can monitor/steer it remotely

Delegate vs Autopilot: Autopilot mode (via Shift+Tab) keeps you in the session and cycles step approvals automatically. Delegation goes one step further - you explicitly hand the task over and can walk away, with Copilot working until the task is complete. Remote control (--remote) complements delegation by letting you check in from anywhere.

Best uses for delegation: long-running tasks (implementing a feature, writing comprehensive tests, refactoring a module) where you want to continue other work or step away from the computer while Copilot makes progress.

What is the key difference between Autopilot mode and using /delegate in Copilot CLI?
Which flag combined with --delegate allows you to monitor the delegated task remotely from GitHub.com?

32. What logging and diagnostic capabilities does GitHub Copilot CLI provide?

Copilot CLI provides several mechanisms for understanding what is happening during a session - from verbose logging to dry-run previews - useful for debugging, auditing, and understanding agent behaviour.

# Enable verbose/debug logging
copilot --log-level debug

# Write logs to a file
copilot --log-file ./copilot-debug.log

# Non-interactive with logging
copilot -p "explain this code" --log-level debug -s

# Check version and build info
copilot --version

# Use /chronicle for session-level history and insights
/chronicle
"Show me everything Copilot did in the last session"
"What tools did Copilot use during this session?"

Diagnostic options
OptionPurpose
--log-level debugVerbose output showing tool calls, API requests, decision logic
--log-file Write log output to a file instead of (or in addition to) stdout
--versionPrint the installed Copilot CLI version
/chronicleQuery past sessions, view what was done, get usage patterns
copilot -p ... -sNon-interactive with clean output - useful for scripted diagnostics

Debug logging is particularly useful when Copilot CLI is not behaving as expected - it shows what tools were called, what inputs they received, and what the model decided at each step, giving full visibility into the agent's reasoning loop.

What log level flag provides the most verbose output for debugging Copilot CLI behaviour?
Where would you look to understand what Copilot CLI did in a past session - specifically which tools it used and what actions it took?

33. What does GitHub Copilot CLI's diff and undo capability provide?

After Copilot makes file modifications, Copilot CLI provides review and undo capabilities so you can inspect changes before committing them or roll back actions that produced unexpected results.

# After Copilot edits files, review the diff
# Copilot CLI shows a diff view of changes made in the session

# Review changes with standard git tooling
git diff                    # see all changes Copilot made
git diff src/api/users.ts   # changes to a specific file

# Undo all changes Copilot made in the session
git checkout .              # restore all tracked files
git clean -fd               # remove any new untracked files Copilot created

# Selective undo - restore just one file
git checkout src/api/users.ts

# Copilot CLI also shows inline diffs during Plan mode
# before executing - use Plan mode (Shift+Tab) to preview
# changes before they are applied

# Best practice: commit your work before a Copilot session
git add -A && git commit -m "WIP: state before Copilot session"
# → Easy rollback point if Copilot makes unwanted changes

Best practice before any Copilot CLI session: commit your current work or stash it (git stash). This gives you a clean rollback point - if Copilot's changes are not what you wanted, a single git checkout . undoes everything since the commit.

What is the recommended approach before starting a Copilot CLI session to protect against unwanted file changes?
What git command restores all tracked files to their last committed state, effectively undoing Copilot's modifications?

34. What are the Windows-specific considerations for GitHub Copilot CLI?

Copilot CLI is supported on Windows but has some differences compared to macOS and Linux that developers should know about - particularly around the shell environment and tool execution.

Windows vs macOS/Linux differences
AspectWindowsmacOS/Linux
ShellPowerShell or Command Prompt (cmd)bash/zsh/fish
Installationnpm install -g @github/copilot OR winget install GitHub.CopilotCLInpm, brew, install script, or WinGet
Bash toolRequires Windows Subsystem for Linux (WSL) or Git Bash for full bash supportNative bash available
Credential storeWindows Credential ManagermacOS Keychain / Linux secret service
Path separatorBackslash (\) - Copilot accounts for thisForward slash (/)
Terminal recommendationWindows Terminal with WSL2Any modern terminal
# Windows installation via WinGet
winget install GitHub.CopilotCLI

# Or via npm (requires Node.js 22+ on Windows)
npm install -g @github/copilot

# Using Copilot CLI in PowerShell
copilot -p "How do I list all running processes in PowerShell?" -s

# For full agentic (bash tool) support on Windows
# install WSL2 and run Copilot CLI from within WSL:
wsl
npm install -g @github/copilot
copilot

The bash tool (used by Copilot for executing shell commands during agentic tasks) requires a bash environment. On Windows, Copilot CLI can run without full bash tool support for chat and planning tasks, but for full agentic execution (especially tasks that involve running build/test commands), running under WSL2 provides the best experience.

For full agentic bash tool support on Windows, what environment is recommended?
What credential store does Copilot CLI use on Windows to store authentication tokens securely?

35. What is the full list of GitHub Copilot CLI command-line flags and their purposes?

Understanding the complete flag set allows you to use Copilot CLI effectively in both interactive and scripted contexts. Flags are passed at launch to configure the session or a single non-interactive call.

GitHub Copilot CLI flags reference
FlagDescription
--versionPrint the installed version and exit
-p, --prompt Run a single non-interactive prompt and exit
-s, --silentSuppress extra output - print only Copilot's response (use with -p)
--model Specify the AI model to use (or 'auto' for automatic selection)
--experimentalEnable experimental/preview features
--no-experimentalDisable experimental features (override persisted setting)
--remoteEnable remote control - monitor and interact from GitHub.com/Mobile
--no-remoteDisable remote control for this session
--remote-exportShare output remotely without full session control
--no-remote-exportDisable remote export
--resume Resume a specific previous or remote task by ID
--connectConnect to an existing remote session
--delegate Delegate a task for autonomous execution
--log-level Set logging verbosity (debug, info, warn, error)
--log-file Write log output to the specified file
-h, --helpShow help and all available flags
# Common flag combinations:

# Run a quick question non-interactively
copilot -p "What is the difference between let and const in JS?" -s

# Start a session with a specific model
copilot --model gpt-4o

# Delegate a task with remote monitoring
copilot --delegate "Add pagination to /api/users" --remote

# Resume a task from the command line
copilot --resume task-abc123

# Debug a failing session
copilot --log-level debug --log-file ./debug.log

Which flag suppresses additional output and prints only Copilot's response, making it suitable for use in shell scripts?
What does the --resume flag allow you to do in GitHub Copilot CLI?

36. How does GitHub Copilot CLI integrate with GitHub issues?

Copilot CLI can work directly with GitHub issues - reading issue details, using issue context to guide implementation, and linking completed work back to issues through pull requests.

# Reference a GitHub issue directly in your prompt
copilot -p "Implement the feature described in issue #42 in this repository"

# Or inside an interactive session:
"Look at issue #123 and implement the requested change in src/"

# Copilot will:
# 1. Fetch the issue details from GitHub
# 2. Understand the requirements from the issue body and comments
# 3. Implement the changes in the relevant files
# 4. Optionally open a PR that references the issue

# Link a PR to close an issue automatically:
"Implement issue #42 and open a PR that will close it when merged"
# → Copilot adds "Closes #42" to the PR description

GitHub integration depth: Copilot CLI accesses GitHub issues via the GitHub API using your authenticated token. It can read the issue title, description, labels, and comments to build context. For organisations using GitHub Projects, Copilot can reference the broader project context when available.

Issue-to-PR workflow: one of Copilot CLI's most powerful workflows is going from a GitHub issue directly to a merged PR without manual intermediate steps - the agent reads the issue, plans the implementation, writes the code, runs tests, and opens the PR, all from a single prompt.

What does Copilot CLI use to fetch GitHub issue details when you reference an issue number in a prompt?
How can you instruct Copilot CLI to create a PR that automatically closes a GitHub issue when merged?

37. What are the key differences when using Copilot CLI on macOS vs Linux?

Copilot CLI runs on both macOS and Linux with near-identical behaviour - the differences are primarily in installation methods, credential storage, and system integration rather than core features.

macOS vs Linux differences
AspectmacOSLinux
Install (recommended)npm install -g @github/copilot OR brew install (check docs)npm install -g @github/copilot OR install script
Install script default dirUses PREFIX or /usr/local/binUses PREFIX or /usr/local/bin
Credential storemacOS Keychain (most secure)libsecret / GNOME Keyring / KWallet (if available)
Fallback credential~/.copilot/ plain text~/.copilot/ plain text (common in servers/containers)
Package manager optionHomebrew (brew)apt/dnf/pacman (no official package - use npm)
Containerised useUncommonCommon - Docker, GitHub Actions runners
# macOS: Homebrew installation (if available)
brew install gh-copilot  # check docs for current formula

# Linux: npm installation
npm install -g @github/copilot

# Linux server (headless): use token auth
export COPILOT_GITHUB_TOKEN=github_pat_xxx
copilot -p "Summarise the git log from the last week" -s

# Linux container: install script non-root
curl -fsSL .../install.sh | PREFIX=$HOME/.local bash
export PATH="$HOME/.local/bin:$PATH"
copilot --version

On Linux servers and CI environments (headless, no UI, no keychain), plain text credential storage to ~/.copilot/ or COPILOT_HOME is the default fallback. Always use environment variable authentication in these environments rather than the interactive login flow.

What credential storage mechanism does Copilot CLI use on macOS for the most secure token storage?
On a headless Linux server without a desktop environment, what is the recommended way to authenticate Copilot CLI?

38. What is the overall workflow for using Copilot CLI on a real development task from start to finish?

Combining all Copilot CLI features into an end-to-end workflow demonstrates how the tool fits into professional development practice.

# ── End-to-end Copilot CLI workflow ──────────────────────────────

# 1. Set up the project for Copilot CLI
cd my-project
copilot
# → Trust prompt: "Yes, and remember this folder"
/init
# → Copilot generates copilot-instructions.md with build/test commands

# 2. Discuss the task in Chat mode
# [Chat mode is active by default]
"I need to add pagination to the GET /api/products endpoint.
We use Express + Prisma. How should I approach this?"
# → Copilot gives advice; refine as needed

# 3. Switch to Plan mode to review steps
# Press Shift+Tab once
"Implement pagination with limit and offset query params,
add Swagger docs, and write Jest unit tests"
# → Copilot outlines steps for review - inspect and confirm

# 4. Execute with Autopilot mode
# Press Shift+Tab again
"Go ahead and implement the plan"
# → Copilot implements autonomously

# 5. Review the changes
git diff
# If happy:
git add -A
git commit -m "feat: add pagination to GET /api/products"

# 6. Open a pull request
/pr
"Create a PR for this branch with a summary of what was added"
# → Copilot opens PR with AI-generated description

# 7. Review session history
/chronicle
"What did I implement today?"

This workflow demonstrates the full spectrum: Chat (discuss) → Plan (review) → Autopilot (execute) → git review → /pr (publish). Copilot CLI compresses what would previously require multiple context switches (editor, terminal, browser) into a single terminal workflow.

In the recommended Copilot CLI workflow, which mode should you use to review Copilot's proposed steps BEFORE execution?
After Copilot CLI implements changes on your behalf, what should you do before committing?
«
»

Comments & Discussions