Reviewing code, editing files, and automating shell tasks from a terminal is simpler when the coding assistant runs in the same session. GitHub Copilot CLI does that on any Ubuntu terminal or SSH connection, and two methods let you install GitHub Copilot on Ubuntu: the official install script for quick setup, or the release archive when you want to verify the download first.
Both methods work identically on Ubuntu 26.04, 24.04, and 22.04. Beyond installation, you sign in with OAuth or a fine-grained token, run prompts interactively or from scripts, and handle updates and removal.
Install GitHub Copilot on Ubuntu
GitHub does not publish GitHub Copilot CLI in Ubuntu’s default APT repositories, so the practical Ubuntu choices are the official install script or the release archive from GitHub Releases. The install script is the fast path, while the archive is better when you want to inspect the download before copying the binary into /usr/local/bin.
| Method | Channel | Version | Updates | Best For |
|---|---|---|---|---|
| Official install script | GitHub install script | Latest stable | copilot update | Most Ubuntu systems, fastest supported setup |
| GitHub release archive | GitHub Releases | Latest stable | copilot update | Inspecting the download first or pinning a specific release later |
Both methods install the same upstream binary on Ubuntu 26.04 LTS, 24.04 LTS, and 22.04 LTS. The commands and expected output are identical across all three releases.
GitHub also supports npm installs, but that path needs Node.js 22 or later. Ubuntu 26.04 ships Node.js 22 in the default repositories, while Ubuntu 24.04 and 22.04 usually need a newer Node.js setup first. For clean cross-version Ubuntu installs, the script and release archive are the better defaults.
Update Ubuntu and Install curl for GitHub Copilot
Ubuntu desktop installs often already include the curl command, but server and minimal images may not. Refresh APT metadata first:
sudo apt update
These commands use
sudowhen they need root privileges. If your account is not in the sudoers file yet, add a new user to sudoers on Ubuntu before continuing.
Install curl and the CA certificate bundle next. The -y flag accepts the package prompt automatically:
sudo apt install -y curl ca-certificates
The ca-certificates package gives curl the trusted certificate store it needs for HTTPS downloads.
Install GitHub Copilot on Ubuntu with the Official Script
The official install script is the simplest Ubuntu method because it downloads the current release, validates the checksum, and places the copilot binary in /usr/local/bin for you:
curl -fsSL https://gh.io/copilot-install | sudo bash
Piping to sudo bash matters here because the script writes to the root-owned /usr/local/bin directory. Without sudo, it would fall back to a per-user install path instead.
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 /usr/local/bin/copilot Installation complete! Run 'copilot help' to get started.
Install GitHub Copilot on Ubuntu from the GitHub Release Archive
The release archive gives you the same binary without running a remote script. Confirm the system architecture first so you grab the right tarball:
dpkg --print-architecture
amd64
curl -fsSL -o copilot-linux-x64.tar.gz https://github.com/github/copilot-cli/releases/latest/download/copilot-linux-x64.tar.gz
If
dpkg --print-architecturereportsarm64, replace everycopilot-linux-x64.tar.gzreference in this section withcopilot-linux-arm64.tar.gz.
Extract the archive, install the binary system-wide, and remove the temporary files:
tar -xzf copilot-linux-x64.tar.gz
sudo install -m 0755 copilot /usr/local/bin/copilot
rm -f copilot copilot-linux-x64.tar.gz
The install command copies the extracted binary into /usr/local/bin with the right executable mode, which is cleaner than unpacking the tarball directly into a system directory.
Verify GitHub Copilot on Ubuntu
Both installation methods place the same copilot command on your path. Check the installed version:
copilot --version
GitHub Copilot CLI 1.0.4. Run 'copilot update' to check for updates.
Confirm the binary location as well:
command -v copilot
/usr/local/bin/copilot
The version number changes as GitHub publishes new releases, but the command path stays the same for either method.
Authenticate GitHub Copilot on Ubuntu
GitHub Copilot CLI is available with all Copilot plans. On Ubuntu, the authentication paths that matter most are interactive OAuth login from the terminal and fine-grained token authentication for headless sessions, while organization-managed accounts also need the Copilot CLI policy enabled.
Sign In to GitHub Copilot on Ubuntu with OAuth
Use the built-in login command when you are working interactively in a terminal:
copilot login
The CLI starts the OAuth device flow, shows a one-time code, and sends you to https://github.com/login/device to approve access. After authorization, the terminal returns a success message and the CLI is ready to use.
To authenticate, visit https://github.com/login/device and enter code 76C4-8A64. Waiting for authorization... Failed to open browser (exit code 3). Please visit https://github.com/login/device and enter the code 76C4-8A64 manually.
On SSH-only Ubuntu hosts, the browser launch usually fails like the example above, so copy the code into a local browser yourself and complete the device flow there.
On Linux, Copilot stores OAuth credentials in the system keychain through
libsecretwhen that service is available. If you are on a headless Ubuntu server without a working keychain, the CLI can fall back to storing credentials in plain text under~/.copilot/config.json.
Authenticate GitHub Copilot on Ubuntu for Headless Sessions
For SSH-only servers, containers, and automation, export a fine-grained token with the Copilot Requests permission instead of using the browser flow. If SSH is not set up yet, install SSH on Ubuntu first.
export COPILOT_GITHUB_TOKEN='github_pat_your_token_here'
Copilot checks COPILOT_GITHUB_TOKEN first, then GH_TOKEN, then GITHUB_TOKEN. Classic personal access tokens that start with ghp_ are not supported by Copilot CLI.
Use GitHub Copilot on Ubuntu
Start Copilot from a project directory that you trust, not from your whole home directory. On the first interactive launch, the CLI asks whether you trust the current folder before it reads, edits, or executes anything inside that tree.
Start an Interactive GitHub Copilot Session on Ubuntu
Launch the full interactive interface from the repository or project you want Copilot to work on:
copilot
From there, you can ask for code changes, explanations, reviews, or GitHub tasks in plain language. If you are not signed in yet, the session prompts you to use /login from inside the interface.
Run a Prompt Immediately with GitHub Copilot on Ubuntu
Use -i when you want an interactive session to open and immediately start working on a prompt:
copilot -i "Review this repository for unused dependencies"
This is useful when you already know the first task and do not want to type it again after the interface opens.
Use GitHub Copilot Non-Interactively on Ubuntu
Use -p when you want Copilot to complete one job and exit. This example lets Copilot run only Git shell commands without asking for approval every time:
copilot -p "Show me this week's commits and summarize them" --allow-tool='shell(git)'
The --allow-tool='shell(git)' flag narrows the automatic approval to Git shell commands instead of opening every tool to the agent.
If you try prompt mode before signing in, Copilot stops with a no-authentication error and tells you to use
/login, token environment variables, orgh auth loginfirst. Thegh auth loginpath works when you already have the GitHub CLI installed on Ubuntu.
Copilot also supports broad approval flags such as
--allow-all, but those are best kept to disposable or tightly controlled environments. On a normal Ubuntu workstation, more specific approval flags are the safer default.
Continue Your Last GitHub Copilot Session on Ubuntu
Resume the most recent local session when you want to pick up where you left off:
copilot --continue
The saved conversation context makes this handy for longer coding tasks that span multiple shell sessions.
Update GitHub Copilot on Ubuntu
Both documented installation methods end up with the same upstream binary, so the built-in updater works the same way for each of them:
copilot update
Checking for updates... No update needed, current version is 1.0.4, fetched latest release is v1.0.4
If a newer release is available, the same command downloads and replaces the current binary. Copilot also auto-updates by default when you launch an interactive session, so manual updates are mainly useful when you want to confirm you are on the latest version before starting work.
Remove GitHub Copilot from Ubuntu
Because both documented methods install the binary in /usr/local/bin, removal starts by deleting that file:
sudo rm -f /usr/local/bin/copilot
Verify that the command is gone:
command -v copilot || echo "copilot not found"
copilot not found
Deleting the binary does not remove your cached package files, local configuration, or stored credentials. Only remove the next path if you want to wipe your Copilot CLI state completely.
rm -rf ~/.copilot
Confirm the local state directory is gone:
test ! -d ~/.copilot && echo "~/.copilot removed"
~/.copilot removed
Troubleshoot GitHub Copilot on Ubuntu
Most Ubuntu issues come from authentication state, approval expectations, or using the wrong install path for the environment.
Fix GitHub Copilot Authentication Errors on Ubuntu
If copilot login completes but the CLI still says you cannot use Copilot, verify that the account has an active Copilot plan and that any organization policy allows the CLI feature. Then run the login flow again:
copilot login
Fine-grained tokens must include the Copilot Requests permission. Classic ghp_ tokens do not work with Copilot CLI.
Fix GitHub Copilot Download Problems on Ubuntu
If the install script cannot reach GitHub through the gh.io short link, switch to the release archive method instead. It downloads the same official binary from GitHub Releases without relying on the redirecting install script URL.
Fix Unexpected GitHub Copilot Token Selection on Ubuntu
Environment variables override any OAuth token you stored with copilot login. If Copilot suddenly starts using the wrong account, clear the token variables in the current shell and start a new session:
unset COPILOT_GITHUB_TOKEN GH_TOKEN GITHUB_TOKEN
After that, run copilot login again if you want to go back to the stored OAuth credentials.
GitHub Copilot on Ubuntu FAQ
The copilot command is the terminal-based GitHub Copilot CLI. If you want Copilot inside the editor, install Visual Studio Code on Ubuntu first, then sign in to GitHub from inside VS Code and add the Copilot extension there.
No. Ubuntu 26.04, 24.04, and 22.04 do not ship GitHub Copilot CLI in the default APT repositories. On Ubuntu, the official Linux options are the GitHub install script, the release archive from GitHub Releases, or npm if you already have Node.js 22 or later available.
Yes, but npm is practical only when your Ubuntu system already has Node.js 22 or later. Ubuntu 26.04 includes Node.js 22 in the default repositories, while Ubuntu 24.04 and 22.04 usually need a newer Node.js setup first. If you want that route, install Node.js on Ubuntu first, then run npm install -g @github/copilot. If you are switching from the install script or release archive method, remove /usr/local/bin/copilot first because npm installs the same binary path and stops with a file-exists error otherwise.
Yes. GitHub Copilot CLI itself runs fine in a terminal-only Ubuntu session. For headless servers, the simplest authentication path is a fine-grained token exported as COPILOT_GITHUB_TOKEN, because you may not have a desktop browser or a working Linux keychain service available on the server.
On Ubuntu, GitHub Copilot CLI keeps its local state under ~/.copilot. That directory can contain configuration files, cached package assets, logs, and, on headless systems without libsecret, plaintext credentials in ~/.copilot/config.json.
Conclusion
GitHub Copilot CLI is running on Ubuntu and ready for terminal use. Point it at a project directory and it handles code suggestions, shell commands, and routine edits right from the prompt. For the full editor experience, pair it with install Visual Studio Code on Ubuntu and add the Copilot extension there. Install Claude Code on Ubuntu and install Codex CLI on Ubuntu are worth a look if you want to compare terminal AI tools. The official Copilot CLI documentation covers additional flags and MCP server setup.
Formatting tips for your comment
You can use basic HTML to format your comment. Useful tags currently allowed:
<code>command</code>command<strong>bold</strong><em>italic</em><blockquote>quote</blockquote>