How to Install GitHub Copilot CLI on Ubuntu 26.04, 24.04 and 22.04

Last updated Wednesday, May 6, 2026 2:17 pm Joshua James 8 min read

Working from the terminal is faster when the coding assistant can see the same repository, shell, and GitHub context you are already using. To install GitHub Copilot CLI on Ubuntu, use GitHub’s Linux install script for the cleanest cross-release setup, or choose npm when you already maintain a Node.js 22 or newer toolchain.

Coverage is Ubuntu 26.04, 24.04, and 22.04 on 64-bit Intel/AMD systems, with an ARM64 note for the manual archive path. After installation, you can authenticate with OAuth, a fine-grained token, or an existing GitHub CLI login, then run Copilot interactively or from a one-shot prompt.

Install GitHub Copilot CLI on Ubuntu

GitHub Copilot CLI is not packaged in Ubuntu’s default APT repositories. GitHub currently documents npm, Homebrew, an install script, and direct downloads, but the most practical Ubuntu choices are the install script, npm for existing Node.js users, and the release archive when you want a manual checksum step.

MethodSourceUbuntu FitUpdate PathBest For
Install scriptGitHub Linux scriptWorks across Ubuntu 26.04, 24.04, and 22.04 without Node.jsBuilt-in updater or rerun scriptMost Ubuntu workstations, servers, and SSH sessions
npm packageGitHub npm methodRequires Node.js 22 or newerRepeat the npm global installDevelopers already using a modern Node.js setup
Release archiveGitHub ReleasesWorks across supported Ubuntu releases after manual downloadBuilt-in updater or reinstall archiveReviewing the asset and checksum before installation

Ubuntu 26.04 currently provides Node.js 22 from the Universe repository component, while Ubuntu 24.04 and 22.04 default to older Node.js branches. If apt cannot locate Node.js on a customized 26.04 system, enable Universe on Ubuntu first. If you do not already need Node.js 22 or newer, the install script avoids changing your JavaScript runtime setup just to install Copilot CLI.

If you came from a Snap search, Snapcraft currently lists a package named copilot-cli, but the listing describes it as a community-maintained wrapper rather than an official GitHub product. Copilot CLI needs project file access, so the upstream script, npm package, or GitHub release archive are better defaults than troubleshooting Snap confinement first.

Update Ubuntu and Install curl for GitHub Copilot CLI

Minimal Ubuntu systems may not include the curl command. Refresh APT metadata before installing the download tools:

sudo apt update

These commands use sudo when 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 so HTTPS downloads and redirects work reliably:

sudo apt install -y curl ca-certificates

The ca-certificates package supplies the trusted certificate store used when curl connects to GitHub and npm over HTTPS.

Install GitHub Copilot CLI with the Official Script

The Linux install script selects the current stable release for your CPU architecture, downloads the matching archive, checks the SHA256SUMS file when checksum tooling is available, and installs copilot into /usr/local/bin when run with sudo:

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

Running the script with sudo gives it permission to write to the root-owned /usr/local/bin directory. Without elevated privileges, the script defaults to a user-local prefix such as $HOME/.local.

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

Install GitHub Copilot CLI with npm

Use npm only when Node.js 22 or newer is already active. If your system still uses Ubuntu 24.04 or 22.04 default Node.js packages, install Node.js on Ubuntu first or use the install script instead.

node --version
v22.x.x

Install the official npm package globally from the Node.js environment you want to use:

npm install -g @github/copilot

If your npm setup uses ignore-scripts=true in ~/.npmrc, GitHub documents a one-command override for the install:

npm_config_ignore_scripts=false npm install -g @github/copilot

If npm asks for root permissions on your Ubuntu system, the install script is usually cleaner than changing your global npm prefix just for Copilot CLI.

Install GitHub Copilot CLI from the GitHub Release Archive

The release archive method downloads the same upstream binary without running the install script. Run the setup in one terminal session so the architecture and filename variables remain available.

case "$(dpkg --print-architecture)" in
  amd64) COPILOT_ARCH="x64" ;;
  arm64) COPILOT_ARCH="arm64" ;;
  *) echo "Unsupported architecture: $(dpkg --print-architecture)"; exit 1 ;;
esac

COPILOT_ARCHIVE="copilot-linux-${COPILOT_ARCH}.tar.gz"

Download the archive and checksum manifest from the latest stable GitHub release:

curl -fsSLO "https://github.com/github/copilot-cli/releases/latest/download/${COPILOT_ARCHIVE}"
curl -fsSLO "https://github.com/github/copilot-cli/releases/latest/download/SHA256SUMS.txt"

Use the grep command to select the checksum line for the chosen Linux archive, then list the tarball contents before installing it:

grep "  ${COPILOT_ARCHIVE}$" SHA256SUMS.txt | sha256sum -c -
tar -tzf "$COPILOT_ARCHIVE"
copilot-linux-x64.tar.gz: OK
copilot

Extract the archive, install the binary system-wide, and delete the temporary download files:

tar -xzf "$COPILOT_ARCHIVE"
sudo install -m 0755 copilot /usr/local/bin/copilot
rm -f copilot "$COPILOT_ARCHIVE" SHA256SUMS.txt

The install command copies the extracted binary into /usr/local/bin with executable permissions, which keeps the archive extraction step separate from the privileged file copy.

Verify GitHub Copilot CLI on Ubuntu

All three covered methods expose the same copilot command. Check the version first:

copilot --version
GitHub Copilot CLI 1.0.x.
Run 'copilot update' to check for updates.

Confirm the binary path that your shell will run:

command -v copilot
/usr/local/bin/copilot

If npm installed Copilot CLI into a user-managed Node.js prefix, your path may be under that Node.js environment instead of /usr/local/bin.

Authenticate GitHub Copilot CLI on Ubuntu

GitHub Copilot CLI works with all Copilot plans, but organization-managed accounts also need the Copilot CLI policy enabled by the organization or enterprise administrator. Authentication can come from the built-in OAuth device flow, environment variables, or an existing GitHub CLI login.

Sign In to GitHub Copilot CLI with OAuth

Use OAuth when you are working interactively in a terminal:

copilot login

The CLI displays a one-time device code, opens your browser when possible, and sends you to https://github.com/login/device. In SSH-only sessions, copy the code into a local browser and return to the terminal after authorization. Do not publish, log, or reuse the temporary code because it is tied to the current login attempt.

On Linux, Copilot CLI stores OAuth credentials through libsecret when a system keychain is available. On headless systems without a keychain, it prompts before storing credentials in plaintext under ~/.copilot/config.json. Use an environment variable token instead when plaintext storage is not acceptable.

Authenticate GitHub Copilot CLI with a Token

For SSH-only hosts, containers, and automation, export a fine-grained personal access token owned by your personal account with the Copilot Requests account permission. If SSH itself is not ready yet, install SSH on Ubuntu first.

export COPILOT_GITHUB_TOKEN='github_pat_your_token_here'

Copilot CLI checks COPILOT_GITHUB_TOKEN first, then GH_TOKEN, then GITHUB_TOKEN. Classic personal access tokens that start with ghp_ are not supported.

Use GitHub CLI Authentication as a Fallback

If gh is installed and authenticated, Copilot CLI can use that token only when no Copilot token environment variable and no stored OAuth token are available:

gh auth status

Use the dedicated walkthrough to install GitHub CLI on Ubuntu if you want GitHub issue, pull request, release, and fallback token support in the same terminal.

Use GitHub Copilot CLI on Ubuntu

Start from a project directory that you trust, not from your whole home directory. Copilot CLI tracks local sessions, saved permissions, and repository context under its configuration directory as you work.

Start an Interactive GitHub Copilot CLI Session

Launch the full terminal interface from the repository or project you want Copilot to inspect:

copilot

From the prompt, ask for code changes, explanations, reviews, or GitHub workflow help. If you are not signed in yet, use /login inside the interface or exit and run copilot login.

Open an Interactive Session with a Starting Prompt

Use -i when you want the interactive interface to open and immediately submit a first request:

copilot -i "Review this repository for unused dependencies"

This keeps the conversation open after Copilot handles the starting prompt.

Run GitHub Copilot CLI Non-Interactively

Use -p for a single programmatic prompt that exits after completion. This example permits Git shell commands without granting every possible tool permission:

copilot -p "Show me this week's commits and summarize them" --allow-tool='shell(git)'

The --allow-tool='shell(git)' option narrows automatic approval to Git commands instead of using broader approval flags such as --allow-all or --yolo.

Continue a Previous GitHub Copilot CLI Session

Resume the most recent session for the current directory, falling back to the globally most recent session when needed:

copilot --continue

Use copilot --resume instead when you want to choose from available sessions or pass a specific session ID.

Update GitHub Copilot CLI on Ubuntu

For the install script or release archive methods, ask the installed binary to check for a newer stable release:

copilot update
Checking for updates...
No update needed, current version is 1.0.x, fetched latest release is v1.0.x

If your system cannot replace a root-owned binary through the built-in updater, rerun the install-script pipeline with elevated privileges. For npm installs, repeat the global npm install because GitHub documents the same command for installation and updates:

npm install -g @github/copilot

Remove GitHub Copilot CLI from Ubuntu

For the install script or release archive methods, remove the standalone binary from /usr/local/bin:

sudo rm -f /usr/local/bin/copilot
hash -r

Verify that the command is no longer discoverable:

command -v copilot || echo "copilot not found"
copilot not found

For an npm install, uninstall the package from the same Node.js environment that installed it:

npm uninstall -g @github/copilot

Deleting the binary or npm package does not remove your local sessions, settings, saved permissions, plugins, or credentials. Remove the next paths only when you want to reset Copilot CLI state for your user account.

rm -rf ~/.copilot "${XDG_CACHE_HOME:-$HOME/.cache}/copilot"

Confirm that the user configuration directory and Linux cache directory are gone:

test ! -d ~/.copilot && test ! -d "${XDG_CACHE_HOME:-$HOME/.cache}/copilot" && echo "Copilot CLI local state removed"
Copilot CLI local state removed

Troubleshoot GitHub Copilot CLI on Ubuntu

Most Ubuntu issues come from missing authentication, an older Node.js runtime, a blocked organization policy, or choosing a package source that does not match the workflow.

Fix GitHub Copilot CLI Authentication Errors

If Copilot CLI reports missing or invalid authentication, check whether an environment variable is overriding your OAuth login:

env | grep -E '^(COPILOT_GITHUB_TOKEN|GH_TOKEN|GITHUB_TOKEN)='

Unset stale token variables in the current shell when you want Copilot CLI to use OAuth or GitHub CLI fallback credentials again:

unset COPILOT_GITHUB_TOKEN GH_TOKEN GITHUB_TOKEN

Then rerun the OAuth flow:

copilot login

If access is still denied, confirm that your account has an active Copilot plan and that your organization or enterprise has not disabled the Copilot CLI policy.

Fix Linux Keychain Problems

When OAuth login cannot use the Linux keychain, check whether secret-tool is available:

command -v secret-tool

Install the command-line secret-tool helper and the GNOME keyring daemon when you prefer secure local credential storage over plaintext fallback. The libsecret-tools package comes from Universe on current Ubuntu releases, so enable that component first on customized systems if APT cannot locate it:

sudo apt install -y libsecret-tools gnome-keyring

Fix npm Install Problems

If the npm install fails on Ubuntu 24.04 or 22.04, check the active Node.js major version first:

node --version

Use Node.js 22 or newer for the npm method. When you do not want to change Node.js for the whole system, switch to the install script because it installs the standalone Copilot CLI binary without using npm.

Fix GitHub Copilot CLI Download Problems

If the gh.io short link is blocked on your network, use the release archive method because it downloads the same stable Linux asset directly from GitHub Releases. If GitHub itself is blocked, solve that network access issue first; switching between the script and archive does not avoid GitHub release downloads.

Conclusion

GitHub Copilot CLI is ready on Ubuntu once the copilot command resolves, authentication works, and your first project directory is selected intentionally. Use the install script for the least runtime friction, npm when Node.js 22 or newer is already part of your workflow, and the release archive when you want a visible checksum step. For editor-based Copilot, install Visual Studio Code on Ubuntu and add the Copilot extension there. Install Claude Code on Ubuntu and install Codex CLI on Ubuntu are useful comparisons for terminal AI tools, while the official GitHub Copilot CLI installation documentation tracks GitHub’s current upstream options.

Follow LinuxCapable

Want more LinuxCapable guides in Google?

Add LinuxCapable as a preferred source so Google can show more of our fresh Linux tutorials in Top Stories and From your sources when relevant.

Add LinuxCapable as a preferred source on Google
Search LinuxCapable

Need another guide?

Search LinuxCapable for package installs, commands, troubleshooting, and follow-up guides related to what you just read.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffeeBuy me a coffee
Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed in published comments:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Got a Question or Feedback?

We read and reply to every comment - let us know how we can help or improve this guide.

Let us know you are human: