Using GitHub Copilot CLI

· 1 min read

Copilot CLI is now in public beta. I hadn’t tried it before, but now I’ve given it a shot. Here’s how to use it and my thoughts on it.

Current CLI version: version 0.5.4-beta (2024-01-04)

Requirements

Like GitHub Copilot, requires a paid subscription

Installation

# Install GitHub CLI
brew install gh

# Update GitHub CLI
brew upgrade gh

# Login to GitHub
gh auth login

# Install copilot
gh extension install github/gh-copilot

After the above installation, you can use it normally

Usage

Currently, the CLI functionality is quite simple:

  1. Explain commands

    gh copilot explain "git push"
    
  2. Suggest commands

    gh copilot suggest "install git"
    

Currently, you cannot set custom prompts, so the returned results will be in English, but command prompts can be described in Chinese since the underlying OpenAI supports multiple languages

https://static.1991421.cn/2024/2024-02-08-231521.jpeg

That’s all there is to the CLI functionality. Looking forward to continued CLI updates, such as supporting system prompts or supporting chat rather than being limited to commands.

Authors
Developer, digital product enthusiast, tinkerer, sharer, open source lover