Trying out GitHub Copilot on the CLI

Jonathan Fielding
3 min readApr 27, 2023
Terminal with Copilot logo

Today I got access to the GitHub Copilot CLI beta and thought I would write a short post based on my initial experience.

Note: This is based on my first day using the tool and I likely will write a further post as I learn more about the tool to help people get the most out of it

Setup

One of the first things I was surprised about was how incredibly simple it was to install the Copilot CLI. I don’t know what I was expecting but I was up and running within minutes.

The first step is to install GitHub Copilot CLI globally on your machine using npm:

npm install -g @githubnext/github-copilot-cli

The next step is to authenticate with GitHub which is achieved by running the following command:

github-copilot-cli auth

You are then given some on-screen instructions, which include visiting a page on github.com and entering an authorisation code. In all very easy to authenticate.

Finally, to enable the command shortcuts you need to run

eval "$(github-copilot-cli alias -- "$0")"

And that is is, the CLI is now fully integrated and you are now ready to use Copilot on the CLI.

Usage

--

--

Jonathan Fielding

Staff Engineer working for @Spendesk, speaker about web things, writing about tech, contributor to open source. If you like what I write make sure to follow.