これは、なにをしたくて書いたもの?
GitHub Copilot CLIがGAになったので、Ubuntu Linux 24.04 LTSにインストールしてみます、というメモです。
GitHub Copilot CLI
GitHub Copilot CLIがGAになりました。
GitHub Copilot CLI is now generally available - GitHub Changelog
GitHub Copilot CLIが、すべての有料プラン向けに一般提供(GA)を開始 - GitHubブログ
端的に言うと、GitHub CopilotをCLIとして(ターミナルで)使えるツールですね。
チャットができるわけではなく、プランモード、オートパイロットモード、エージェント、MCPやプラグイン、スキル
といったものが利用できます。
GitHub Copilot CLIのページはこちら。
ドキュメントはこちら。
GitHub Copilot CLI の始め方 - GitHub ドキュメント
サポートされているモデルはこちらですね。
GitHub Copilot でサポートされている AI モデル - GitHub ドキュメント
ひとまず使ってみましょうか。
環境
今回の環境はこちら。Ubuntu Linux 24.04 LTSです。
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 24.04.4 LTS Release: 24.04 Codename: noble $ uname -srvmpio Linux 6.8.0-101-generic #101-Ubuntu SMP PREEMPT_DYNAMIC Mon Feb 9 10:15:05 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
npm版をインストールするので、Node.jsも。
$ node --version v24.14.0 $ npm --version 11.9.0
GitHub Copilot CLIをインストールする
GitHub Copilot CLIのQuick Startページはこちら。
GitHub Copilot CLI の始め方 - GitHub ドキュメント
まずインストール方法ですが、以下の4つがあるようです。
- npm
- winget(Windows)
- Homebrew(macOS/Linux)
- curl+bash
GitHub Copilot CLI のインストール - GitHub ドキュメント
ひとまずnpm版をインストールしてみましょう。
$ npm install -g @github/copilot
インストールされました。
$ copilot --version GitHub Copilot CLI 1.0.2. Run 'copilot update' to check for updates.
アップデートはcopilot updateみたいですね。
$ copilot --help Usage: copilot [options] [command] GitHub Copilot CLI - An AI-powered coding assistant. Start an interactive session to chat with Copilot, or use -p/--prompt for non-interactive scripting. Copilot can edit files, run shell commands, search your codebase, and more — all with configurable permissions. Run `copilot <command> --help` for details on any subcommand. Options: --acp Start as Agent Client Protocol server --add-dir <directory> Add a directory to the allowed list for file access (can be used multiple times) --add-github-mcp-tool <tool> Add a tool to enable for the GitHub MCP server instead of the default CLI subset (can be used multiple times). Use "*" for all tools. --add-github-mcp-toolset <toolset> Add a toolset to enable for the GitHub MCP server instead of the default CLI subset (can be used multiple times). Use "all" for all toolsets. --additional-mcp-config <json> Additional MCP servers configuration as JSON string or file path (prefix with @) (can be used multiple times; augments config from ~/.copilot/mcp-config.json for this session) --agent <agent> Specify a custom agent to use --allow-all Enable all permissions (equivalent to --allow-all-tools --allow-all-paths --allow-all-urls) --allow-all-paths Disable file path verification and allow access to any path --allow-all-tools Allow all tools to run automatically without confirmation; required for non-interactive mode (env: COPILOT_ALLOW_ALL) --allow-all-urls Allow access to all URLs without confirmation --allow-tool [tools...] Tools the CLI has permission to use; will not prompt for permission --allow-url [urls...] Allow access to specific URLs or domains --alt-screen [value] Use the terminal alternate screen buffer (on|off) --autopilot Enable autopilot continuation in prompt mode --available-tools [tools...] Only these tools will be available to the model --banner Show the startup banner --bash-env [value] Enable BASH_ENV support for bash shells (on|off) --config-dir <directory> Set the configuration directory (default: ~/.copilot) --continue Resume the most recent session --deny-tool [tools...] Tools the CLI does not have permission to use; will not prompt for permission --deny-url [urls...] Deny access to specific URLs or domains, takes precedence over --allow-url --disable-builtin-mcps Disable all built-in MCP servers (currently: github-mcp-server) --disable-mcp-server <server-name> Disable a specific MCP server (can be used multiple times) --disallow-temp-dir Prevent automatic access to the system temporary directory --enable-all-github-mcp-tools Enable all GitHub MCP server tools instead of the default CLI subset. Overrides --add-github-mcp-toolset and --add-github-mcp-tool options. --excluded-tools [tools...] These tools will not be available to the model --experimental Enable experimental features -h, --help display help for command -i, --interactive <prompt> Start interactive mode and automatically execute this prompt --log-dir <directory> Set log file directory (default: ~/.copilot/logs/) --log-level <level> Set the log level (choices: "none", "error", "warning", "info", "debug", "all", "default") --max-autopilot-continues <count> Maximum number of continuation messages in autopilot mode (default: unlimited) --model <model> Set the AI model to use (choices: "claude-sonnet-4.6", "claude-sonnet-4.5", "claude-haiku-4.5", "claude-opus-4.6", "claude-opus-4.6-fast", "claude-opus-4.5", "claude-sonnet-4", "gemini-3-pro-preview", "gpt-5.4", "gpt-5.3-codex", "gpt-5.2-codex", "gpt-5.2", "gpt-5.1-codex-max", "gpt-5.1-codex", "gpt-5.1", "gpt-5.1-codex-mini", "gpt-5-mini", "gpt-4.1") --mouse [value] Enable mouse support in alt screen mode (on|off) --no-alt-screen Disable the terminal alternate screen buffer --no-ask-user Disable the ask_user tool (agent works autonomously without asking questions) --no-auto-update Disable downloading CLI update automatically (disabled by default in CI environments) --no-bash-env Disable BASH_ENV support for bash shells --no-color Disable all color output --no-custom-instructions Disable loading of custom instructions from AGENTS.md and related files --no-experimental Disable experimental features --no-mouse Disable mouse support in alt screen mode --output-format <format> Output format: 'text' (default) or 'json' (JSONL, one JSON object per line) (choices: "text", "json") -p, --prompt <text> Execute a prompt in non-interactive mode (exits after completion) --plain-diff Disable rich diff rendering (syntax highlighting via diff tool specified by git config) --plugin-dir <directory> Load a plugin from a local directory (can be used multiple times) --resume [sessionId] Resume from a previous session (optionally specify session by ID, or start a new session with a specific UUID -s, --silent Output only the agent response (no stats), useful for scripting with -p --screen-reader Enable screen reader optimizations --secret-env-vars [vars...] Space-separated environment variable names whose values are stripped from shell and MCP server environments and redacted from output (e.g., --secret-env-vars MY_KEY OTHER_KEY) --share [path] Share session to markdown file after completion in non-interactive mode (default: ./copilot-session-<id>.md) --share-gist Share session to a secret GitHub gist after completion in non-interactive mode --stream <mode> Enable or disable streaming mode (choices: "on", "off") -v, --version show version information --yolo Enable all permissions (equivalent to --allow-all-tools --allow-all-paths --allow-all-urls) Commands: help [topic] Display help information init Initialize Copilot instructions login [options] Authenticate with Copilot plugin Manage plugins update Download the latest version version Display version information Help Topics: commands Interactive Mode Commands config Configuration Settings environment Environment Variables logging Logging permissions Permissions Examples: # Start interactive mode $ copilot # Start interactive mode and automatically execute a prompt $ copilot -i "Fix the bug in main.js" # Execute a prompt in non-interactive mode (exits after completion) $ copilot -p "Fix the bug in main.js" --allow-all-tools # Enable all permissions with a single flag $ copilot -p "Fix the bug in main.js" --allow-all $ copilot -p "Fix the bug in main.js" --yolo # Start with a specific model $ copilot --model gpt-5.2 # Resume the most recent session $ copilot --continue # Resume a previous session using session picker $ copilot --resume # Resume a specific session by ID $ copilot --resume <session-id> # Start a new session with a specific UUID $ copilot --resume 0cb916db-26aa-40f2-86b5-1ba81b225fd2 # Resume with auto-approval $ copilot --allow-all-tools --resume # Allow access to additional directory $ copilot --add-dir /home/user/projects # Allow multiple directories $ copilot --add-dir ~/workspace --add-dir /tmp # Disable path verification (allow access to any path) $ copilot --allow-all-paths # Allow all git commands except git push $ copilot --allow-tool 'shell(git:*)' --deny-tool 'shell(git push)' # Allow all file editing $ copilot --allow-tool 'write' # Allow all but one specific tool from MCP server with name "MyMCP" $ copilot --deny-tool 'MyMCP(denied_tool)' --allow-tool 'MyMCP' # Allow GitHub API access (defaults to HTTPS) $ copilot --allow-url github.com # Deny access to specific domain over HTTPS $ copilot --deny-url https://malicious-site.com $ copilot --deny-url malicious-site.com # Allow all URLs without confirmation $ copilot --allow-all-urls # Initialize Copilot instructions for a repository $ copilot init Learn More: Use `copilot <command> --help` for more information about a command. Read the documentation at https://docs.github.com/copilot/how-tos/copilot-cli
起動してみます。
$ copilot
一瞬、すごい派手な表示が出た後にこんな表示になります。
╭──────────────────────────────────────────────────────────────────────────────────────────────────╮ │ ╭─╮╭─╮ │ │ ╰─╯╰─╯ GitHub Copilot v1.0.2 │ │ █ ▘▝ █ Describe a task to get started. │ │ ▔▔▔▔ │ │ Tip: /plugin Manage plugins and plugin marketplaces │ │ Copilot uses AI, so always check for mistakes. │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────╯ ● 💡 No copilot instructions found. Run /init to generate a copilot-instructions.md file for this project. ● Environment loaded ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ Confirm folder trust │ │ │ │ ╭───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ │ │ /path/to/project │ │ │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ Copilot may read files in this folder. Reading untrusted files may lead Copilot to behave in unexpected ways. With your permission, Copilot may execute code or bash commands in │ │ this folder. Executing untrusted code is unsafe. │ │ │ │ Do you trust the files in this folder? │ │ │ │ ❯ 1. Yes │ │ 2. Yes, and remember this folder for future sessions │ │ 3. No (Esc) │ │ │ │ ↑↓ to navigate · Enter to select · Esc to cancel │ ╰───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
自己紹介をお願いしてみます。
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ❯ 自己紹介してください ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
GitHubにログインする必要があるようです。
✗ You must be logged in to send messages. Please run /login Please use /login to sign in to use Copilot
/loginでログイン。
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ❯ /login ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
GitHub.comかGitHub Enterpriseか聞かれるので、どちらか選んでください。自分はGitHub.comを選びました。
ログインすると、こんな表示になります。
● Environment loaded ● GitHub MCP Server: Connected ● Signed in successfully as [ユーザー名]! ● MCP Servers reloaded: 1 server connected
自己紹介をお願いしてみます。
❯ 自己紹介してください ◐ The user is asking me to introduce myself in Japanese (自己紹介してください = "Please introduce yourself"). According to my instructions, when users ask about my capabilities or features, I should call the `fetch_copilot_cli_documentation` tool first. This is an introductory question that falls into that category. Let me fetch the documentation and then introduce myself based on that. ● Checking my documentation └ # GitHub Copilot CLI Documentation ● こんにちは!私は GitHub Copilot CLI です。以下が私の紹介です: 🚀 私について 私はGitHub Copilotのターミナル版で、あなたのコマンドラインで直接AI駆動のコーディング支援を提供します。ローカルの開発環境で作業しながら、高度なAIアシスタントと協力できます。 💡 主な機能 - コード編集・デバッグ・リファクタリング - AIアシスタントと一緒に複雑なタスクを計画・実行できます - GitHub統合 - リポジトリ、Issue、プルリクエストに自然言語でアクセス - 複数モデル対応 - Claude Sonnet 4.5、Claude Sonnet 4、GPT-5などから選択可能 - プレビュー機能 - 実行前にすべての変更をプレビュー可認可制 🛠️ できること - 📝 コードの作成・修正 - 🔍 コードベースの分析・理解 - 🧪 テストの作成と実行 - 📚 ドキュメント作成 - 🐛 バグの調査・修正 - 🔄 リファクタリング ⌨️ 便利なコマンド - /plan - 実装計画を作成 - /model - モデル選択 - /diff - 変更差分を表示 - /review - コードレビュー実行 - Shift+Tab - モード切り替え(インタラクティブ↔プラン) - /help - ヘルプ表示 現在私はあなたのディレクトリ (/path/to/project) で動作しています。何かお手伝いできることはありますか?
モデルは、/modelで切り替えるようです。
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ❯ /model [model] ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
選択肢。現在はClaude Haiku 4.5を使っています。
Select Model Choose the AI model to use for Copilot CLI. The selected model will be persisted and used for future sessions. Some models are not available. For information on Copilot policies and subscription, visit: https://github.com/settings/copilot/features Search models... ❯ Claude Haiku 4.5 (default) ✓ 1x GPT-5 mini 1x GPT-4.1 1x ↑↓ to navigate · Enter to select · Esc to cancel
「Hello World」を出力するJavaプログラムを作成してもらいましょう。
❯ Hello World を出力するJavaプログラムを作成してください ◐ ユーザーは、Hello World を出力するJavaプログラムを作成してほしいとリクエストしています。 これは非常にシンプルなタスクです: 1. JavaプログラムファイルとしてHelloWorld.javaを作成 2. 標準的な「Hello World」プログラムを実装 3. コンパイル・実行してテスト まずは、カレントディレクトリを確認して、プログラムを作成し、実行するという流れになります。 目的を設定し、ファイルを作成し、実行を確認します。 ● Create HelloWorld.java (+6) ● ファイルを作成しました。では、コンパイルして実行します: ● Compile and run HelloWorld.java $ cd /path/to/project && javac HelloWorld.java && java HelloWorld └ 2 lines... ● 完了しました!✅ HelloWorld.java を作成し、正常にコンパイル・実行できました。 - ファイル作成: /path/to/project/HelloWorld.java - 出力: Hello World プログラムは標準的なJavaの構文で、mainメソッドから System.out.println() で "Hello World" を出力しています。
よさそうです。
それから、よく見ると現在のモデルと使えるリクエストの残量は常に表示されていそうですね。
/path/to/project claude-haiku-4.5 (1x) ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── ❯ Type @ to mention files, # for issues/PRs, / for commands, or ? for shortcuts ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── shift+tab switch mode <200b> Remaining reqs.: 0%
インストール先を見ると、npmモジュールとしてインストールされていそうです。
$ ll $(which copilot) lrwxrwxrwx 1 xxxxx xxxxx 49 3月 8 21:36 $HOME/.nvm/versions/node/v24.14.0/bin/copilot -> '../lib/node_modules/@github/copilot/npm-loader.js'*
スクリプトを見てみましょう。
~/.nvm/versions/node/v24.14.0/lib/node_modules/\@github/copilot/npm-loader.js
#!/usr/bin/env node /*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. *--------------------------------------------------------------------------------------------*/ import{spawnSync as e}from"node:child_process";import{fileURLToPath as s}from"node:url";async function t(){try{const o=s(import.meta.resolve(`@github/copilot-${process.platform}-${process.arch}`)),r=e(o,process.argv.slice(2),{stdio:"inherit"});process.exit(r.status??1)}catch{}parseInt(process.versions.node.split(".")[0],10)<24&&(console.error(`GitHub Copilot CLI requires Node.js v24 or higher. Currently using v${process.versions.node}.`),process.exit(1));try{await import("./index.js")}catch(o){console.error("Failed to load GitHub Copilot CLI:",o),process.exit(1)}}t();
node_modules/@github配下を見たら、けっこういろいろ入っていました。
$ find ~/.nvm/versions/node/v24.14.0/lib/node_modules/\@github -type f
オマケ: curl+bashでインストールする
curl+bashでもインストールしてみましょう。
$ curl -fsSL https://gh.io/copilot-install | bash
この場合、$HOME/.local/binディレクトリーにインストールされるようです。
Installing GitHub Copilot CLI... Downloading from: https://github.com/github/copilot-cli/releases/latest/download/copilot-linux-x64.tar.gz ✓ Checksum validated ✓ GitHub Copilot CLI installed to $HOME/.local/bin/copilot Installation complete! Run 'copilot help' to get started.
バージョン表示。
$ copilot --version GitHub Copilot CLI 1.0.2. Run 'copilot update' to check for updates.
こちらはネイティブ版かつシングルバイナリーみたいです。
$ file $(which copilot) $HOME/.local/bin/copilot: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=7ec13eaf1ff43c56457f45f1bc288c1884fbe4e2, for GNU/Linux 3.2.0, with debug_info, not stripped, too many notes (256)
どちらが推奨と書かれているわけでもないですが…ネイティブ版を使った方がいいのでしょうか?
おわりに
Ubuntu Linux 24.04 LTSにGitHub Copilot CLIをインストールしてみました。
使うかどうかはちょっと微妙なのですが、まずは雰囲気をということで…。