UbuntuUbuntu Based

How To Install GitHub Copilot on Ubuntu 24.04 LTS

Install GitHub Copilot on Ubuntu 24.04

Artificial intelligence has fundamentally changed the way developers write code. GitHub Copilot — one of the most powerful AI coding assistants available today — brings real-time inline code suggestions, natural language query support, and intelligent command-line automation directly into your workflow. If you are running Ubuntu 24.04 LTS (Noble Numbat) and want to set up GitHub Copilot from scratch, this step-by-step guide covers everything you need, from prerequisites to troubleshooting.

Whether you prefer a full IDE environment or a clean terminal-based workflow, there are two proven installation methods to choose from. You will learn both.

What Is GitHub Copilot?

GitHub Copilot is an AI-powered pair programmer developed by GitHub and OpenAI. It is trained on billions of lines of publicly available code and uses large language models (LLMs) — including variants of GPT-4 — to generate contextually aware code suggestions in real time. The tool integrates seamlessly into popular editors and the command line, making it one of the most versatile developer productivity tools available.

Here is what GitHub Copilot can do for you:

  • Inline code completions — suggests single lines or entire functions as you type
  • Multi-line block generation — generates complete code blocks based on comments or function names
  • GitHub Copilot Chat — a conversational AI interface for asking code questions, requesting explanations, and generating test cases
  • CLI integration — gh copilot suggest and gh copilot explain bring AI assistance directly to the terminal
  • Multi-language support — works across Python, JavaScript, TypeScript, Go, Rust, Bash, Java, and 20+ other languages

On Ubuntu 24.04 LTS, GitHub Copilot integrates particularly well. The terminal-centric nature of Linux development, combined with Ubuntu’s robust package management, makes it an ideal host for both the IDE and CLI versions of Copilot.

GitHub Copilot Plans and Pricing

Before setting up the extension, make sure you have an active GitHub Copilot plan. GitHub offers five subscription tiers to fit individual developers, teams, and enterprises:

Plan Monthly Cost Key Inclusions
Copilot Free $0 2,000 code completions + 50 premium AI requests/month
Copilot Pro $10/month Unlimited completions + 300 premium requests/month
Copilot Pro+ $39/month 1,500 premium requests + access to newest AI models
Copilot Business $19/user/month Organization-level policies + audit logs
Copilot Enterprise $39/user/month Enterprise knowledge bases + custom model fine-tuning

For individual developers, the free plan is the smartest starting point. It gives you enough completions to evaluate the tool before committing to a paid tier. Students, verified teachers, and active open-source maintainers can access Copilot Pro at no cost through the GitHub Student Developer Pack.

To activate a plan, log into your GitHub account, navigate to Settings → Copilot, and select your preferred subscription.

Prerequisites Before You Begin

Before running a single command, confirm the following requirements are in place:

  • Operating System: Ubuntu 24.04 LTS (Noble Numbat) — 64-bit. Verify with: lsb_release -a
  • GitHub Account: Active account at github.com with a Copilot subscription enabled
  • Internet Connection: Required for authentication, real-time completions, and package downloads
  • sudo Privileges: Administrative access for installing packages via APT or Snap
  • Hardware Minimum: At least 2 GB RAM and a 1 GHz processor (VS Code minimum requirement)
  • Browser: Any modern browser for the OAuth device authorization flow

Verify your system and update your package index before starting:

lsb_release -a && sudo apt update

Method 1 — Install GitHub Copilot via VS Code Extension

This is the most feature-rich method and the recommended approach for most developers. The VS Code extension delivers the full GitHub Copilot experience — inline completions, Copilot Chat, code explanations, and test generation — all inside a polished IDE.

Step 1: Update Your Ubuntu 24.04 System

Always begin with a full system update. This ensures your package lists are current and prevents dependency conflicts during installation.

sudo apt update && sudo apt upgrade -y

The -y flag auto-confirms prompts, saving you time. On a fresh Ubuntu 24.04 LTS install, this process typically takes one to three minutes depending on your internet speed.

Step 2: Install Visual Studio Code on Ubuntu 24.04

There are two clean ways to install VS Code on Ubuntu 24.04 LTS. The APT repository method is recommended because it integrates with the system package manager and keeps VS Code updated automatically.

Option A — Install via the Microsoft APT Repository (Recommended)

First, install the required supporting tools:

sudo apt install wget gpg apt-transport-https -y

Next, import Microsoft’s official GPG signing key to verify package authenticity:

wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg

Register the VS Code APT repository:

echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" | sudo tee /etc/apt/sources.list.d/vscode.list > /dev/null

Finally, refresh the package index and install VS Code:

sudo apt update && sudo apt install code -y

Confirm the installation was successful:

code --version

Option B — Install via Snap (Fastest Method)

If you prefer a quicker one-command installation, Snap works perfectly:

sudo snap install code --classic

The --classic confinement flag is required because VS Code needs unrestricted access to your file system — a capability that Snap’s default sandboxing does not permit. Both options result in a fully functional Visual Studio Code installation.

Step 3: Open VS Code and Access the Extensions Panel

Launch VS Code directly from the terminal:

code .

This opens VS Code in your current working directory. Alternatively, search for “Visual Studio Code” in the Ubuntu applications menu and click to launch.

Once VS Code is open, access the Extensions panel using the keyboard shortcut Ctrl + Shift + X. You can also click the four-square icon in the left Activity Bar. The Extensions Marketplace sidebar opens immediately, displaying featured and recommended extensions.

Step 4: Install the GitHub Copilot Extension

In the Extensions search bar at the top of the sidebar, type GitHub Copilot.

Look for the official extension published by GitHub. It will display the verified blue publisher badge next to the name — this is your trust signal that you are installing the legitimate extension. Click the blue Install button.

VS Code handles the download and installation automatically. No terminal command is needed here. Once complete, a small Copilot status icon appears in the bottom-right corner of the VS Code status bar.

⚠️ Important: Never install unofficial or third-party Copilot extensions. Only use the extension from the verified GitHub publisher to avoid security risks.

Step 5: Install GitHub Copilot Chat

After the main extension installs, search for GitHub Copilot Chat in the same Extensions panel and click Install.

This companion extension unlocks the full conversational AI experience. With Copilot Chat, you can:

  • Open an inline chat window directly inside your code editor
  • Use the dedicated Copilot Chat sidebar panel
  • Ask natural language questions like “Explain this function” or “Write a unit test for this class”
  • Request code refactoring suggestions with a single prompt

Both extensions work in tandem. Installing only the base Copilot extension without Chat limits your access to inline completions only.

Step 6: Sign In to GitHub from VS Code

After installation completes, VS Code displays a notification: “Sign in to use GitHub Copilot.” Click Sign In to GitHub directly from that notification pop-up.

Alternatively, click the Copilot status icon in the bottom-right status bar and select Sign In to GitHub from the dropdown menu.

A browser window opens automatically and redirects to GitHub’s authentication page. Log in with your GitHub username and password. If your account has Two-Factor Authentication (2FA) enabled — and it should — complete the 2FA verification step before proceeding.

Step 7: Authorize GitHub Copilot in the Browser

VS Code generates an 8-character device activation code and displays it on screen.

In your browser, navigate to:

https://github.com/login/device

Enter the device code exactly as shown and click Continue. GitHub will display the list of permissions GitHub Copilot requires. Review the permissions and click Authorize GitHub Copilot Plugin to grant access.

Switch back to VS Code. A confirmation notification will appear: “GitHub Copilot is now active.” The Copilot icon in the status bar will become fully illuminated — no warning symbols or error indicators.

Your AI coding assistant is now live inside VS Code on Ubuntu 24.04 LTS.

Method 2 — Install GitHub Copilot via the CLI

The CLI method is ideal for server administrators, DevOps engineers, and developers who live in the terminal. No graphical IDE is required. GitHub Copilot CLI brings gh copilot suggest and gh copilot explain directly to your command line, making it a powerful tool for Linux automation and shell scripting.

Step 1: Install Node.js on Ubuntu 24.04

GitHub Copilot CLI requires Node.js v16.0.0 or later. Check if Node.js is already installed:

node --version

If it is not installed, or if your version is outdated, install the current LTS release via the NodeSource repository:

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt install -y nodejs

Verify both Node.js and npm are installed correctly:

node --version && npm --version

Step 2: Install GitHub CLI on Ubuntu 24.04

The GitHub CLI (gh) is a required dependency for the Copilot CLI extension. The simplest installation uses APT:

sudo apt install gh -y

For the most current GitHub CLI version, add the official GitHub CLI repository:

sudo mkdir -p -m 755 /etc/apt/keyrings
wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update && sudo apt install gh -y

Confirm the installation:

gh --version

Step 3: Authenticate with GitHub CLI

With gh installed, authenticate your GitHub account:

gh auth login

Follow the interactive prompts in this exact order:

  1. Select GitHub.com
  2. Choose HTTPS as your preferred protocol
  3. Select Login with a web browser
  4. Copy the one-time code displayed in your terminal
  5. Open the URL shown on screen in your browser
  6. Paste the code and click Authorize GitHub CLI

Return to the terminal and confirm successful authentication:

gh auth status

If your GitHub username appears in the output, authentication succeeded.

Step 4: Install the GitHub Copilot CLI Extension

With authentication confirmed, install the official gh-copilot extension with one command:

gh extension install github/gh-copilot

This adds the gh copilot subcommand to your GitHub CLI toolkit. Verify the installation:

gh copilot --help

You will see two primary subcommands: suggest and explain. Keep the extension current with:

gh extension upgrade gh-copilot

Note: If your organization has disabled Copilot in the CLI through policy settings, this step will fail with a policy error. Contact your GitHub organization administrator to enable CLI access.

Step 5: Use Copilot CLI in Your Terminal

With the extension active, start using AI assistance directly from the command line.

Get AI-powered command suggestions:

gh copilot suggest "find all .log files larger than 100MB and delete them"

Explain an unfamiliar command:

gh copilot explain "tar -czf archive.tar.gz /path/to/folder"

Copilot detects your current shell (Bash or Zsh) and tailors suggestions accordingly. To explicitly specify the shell type, use the -t flag:

gh copilot suggest -t bash "compress and encrypt a directory with openssl"

This terminal-first workflow is especially valuable for Linux system administration, DevOps scripting, and learning new command-line tools.

Testing Your GitHub Copilot Setup

Whether you installed via VS Code or the CLI, run a quick test to confirm everything is working as expected.

Testing inline suggestions in VS Code:

  1. Open the terminal in VS Code: Ctrl + ~
  2. Create a new test file: touch test_copilot.py
  3. Open the file and type a comment: # Function to generate a Fibonacci sequence up to n terms
  4. Pause for one second — Copilot generates the entire function body as grey ghost text
  5. Press Tab to accept the suggestion
  6. Press Alt + ] or Alt + [ to cycle through alternate AI-generated options
  7. Press Ctrl + Enter to open the full Copilot Completions panel and compare multiple suggestions

Testing Copilot Chat in VS Code:

  • Open Copilot Chat with Ctrl + Shift + I
  • Highlight a block of code, right-click, and select Copilot → Explain This
  • Or type directly in the chat box: “How do I handle exceptions in this Python function?”

Testing the CLI:

gh copilot suggest "list all running Docker containers sorted by memory usage"

A confident, working response confirms your setup is fully operational.

Troubleshooting Common GitHub Copilot Issues on Ubuntu 24.04

Even a clean installation can run into occasional hiccups. Here are the most common issues and how to resolve them.

Issue 1 — “GitHub Copilot Could Not Connect to Server”

This is almost always a network or firewall issue. Check your connection first:

ping github.com -c 4

Verify that UFW is not blocking outbound HTTPS traffic on port 443:

sudo ufw status

If a proxy is interfering, unset the proxy environment variables:

unset HTTP_PROXY HTTPS_PROXY http_proxy https_proxy

Issue 2 — No Inline Suggestions Appearing in VS Code

  • Reload VS Code: Ctrl + Shift + P → type Developer: Reload Window → press Enter
  • Confirm the GitHub Copilot extension is enabled in the Extensions panel (not toggled off)
  • Check the status bar at the bottom of VS Code for any Copilot error icon
  • Ensure the file language is supported — Copilot does not generate suggestions for plain text files by default

Issue 3 — Sign-In Loop or Repeated Authentication Prompts

Sign out fully and re-authenticate:

  • In VS Code: Click your Profile icon → Sign Out of GitHub
  • For the CLI: gh auth logout followed by gh auth login

Clear VS Code’s credential cache if the loop persists: Ctrl + Shift + P → Clear Editor History.

Issue 4 — Free Plan Limit Reached Early

The Free plan resets on a rolling monthly basis from your subscription start date. If you hit the 2,000 code completion limit before the month ends, Copilot will display a limit warning. You can either wait for the reset date or upgrade to Copilot Pro for unlimited completions at $10/month.

Issue 5 — CLI Extension Installation Fails

  • Confirm Node.js v16+: node --version
  • Confirm gh is authenticated: gh auth status
  • If behind a corporate proxy, configure npm proxy settings: npm config set proxy http://proxy:port

Congratulations! You have successfully installed GitHub Copilot. Thanks for using this tutorial for installing GitHub Copilot code completion and programming AI-assistant on Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the official GitHub Copilot website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button