Particle Hunter

How to install Github Copilot Cli on lxplus


In a previous blog post I have explained how to install Github Copilot on lxplus machines. In this post I will explain how to install Github Copilot CLI on lxplus machines. The CLI version of Copilot is a command line tool that allows you to use Copilot in your terminal. This can be useful if you just need to ask question about how to do something quickly without having to google it or go to vim.

The setup is similar to the Github case, we don’t have root permissions so we cannot install it from OS package manager. We need to download the binary and install it in our home directory. I assume you are using the same folder ~/local to install the binary like in the previous post.

Prerequisites

Setup

Step 1: Downloading GitHub CLI

Begin by downloading the GitHub CLI (gh) binary. Ensure you check the GitHub CLI releases page for the latest version. The version used in this tutorial is 2.46.0.

wget https://github.com/cli/cli/releases/download/v2.46.0/gh_2.46.0_linux_amd64.tar.gz

Step 2: Extracting the Archive

Once the download completes, extract the archive and remove the tar.gz file.

tar xvfz gh_2.46.0_linux_amd64.tar.gz

Now you should have a directory named gh_2.46.0_linux_amd64 in your current directory. Also remove the tar.gz file.


rm -f gh_2.46.0_linux_amd64.tar.gz
cd gh_2.46.0_linux_amd64/

Step 3: Installing GitHub CLI

Move the gh binary to a directory that is in your path. This tutorial uses $HOME/local/bin, but you can adjust this according to your preferences if you have a different directory in your path.

mv bin/gh $HOME/local/bin

Ensure that $HOME/local/bin is in your PATH. You might need to add export PATH="$HOME/local/bin:$PATH" to your .bashrc or .zshrc file.

Step 4: Verifying the Installation

To verify that gh is correctly installed, run:

gh --version

This command should output the version of gh you installed.

Step 5: Installing GitHub Copilot CLI Extension

With gh installed, you can now install the GitHub Copilot CLI extension:

gh extension install github/copilot

This will install the GitHub Copilot CLI extension, which allows you to use Copilot in your terminal. To use Copilot, you can run:

gh copilot

For more information on how to use Copilot, you can run:

gh copilot --help

That’s it! You have successfully installed GitHub Copilot CLI on your lxplus machine. You can now use Copilot in your terminal to get code suggestions and completions.

#github #copilot #cli #lxplus