October 29th, 2024

GitHub Copilot in Windows Terminal

Christopher Nguyen
Product Manager II, Windows Terminal

GitHub Copilot users can now use the power of GitHub Copilot to get command suggestions and explanations without leaving the terminal with Terminal Chat in Windows Terminal Canary 🚀

This is available for all GitHub Copilot Individual, Business, and Enterprise customers. To get started, sign up for a GitHub Copilot free trial and check out the GitHub Copilot quickstart guide.

Header image displaying GitHub Copilot in Windows Terminal

What is GitHub Copilot?

GitHub Copilot is an AI coding assistant that helps you write code faster and with less effort, allowing you to focus more energy on problem solving and collaboration.

GitHub Copilot has been proven to increase developer productivity and accelerate the pace of software development. For more information, see “Research: quantifying GitHub Copilot’s impact on developer productivity and happiness” in the GitHub blog.

What is Terminal Chat?

Terminal Chat is a feature in Windows Terminal Canary that allows the user to chat with an AI service (like GitHub Copilot 😉) to get intelligent suggestions in the context of their terminal.

This feature does not ship with its own large-language model and can also be managed by Group Policy. See “Group Policies for Windows Terminal” for more information.

Use GitHub Copilot in Terminal Chat

Connecting GitHub Copilot in Terminal Chat allows you to get command suggestions and explanations without leaving the terminal. This is available for all GitHub Copilot Individual, Business, and Enterprise customers.

Prerequisites

If you have access to GitHub Copilot via your organization, you won’t be able to use GitHub Copilot if your organization owner has disabled GitHub Copilot in the CLI. See “Managing policies for Copilot in your organization.”

Setup

  1. Open the dropdown menu and select Settings
  2. Go to the Terminal Chat (Experimental) setting
  3. Under Service Providers, select GitHub Copilot and Authenticate via GitHub to sign in to your GitHub account
  4. After successfully authenticating, ensure that Set as active provider is checked and click Save

After this, you will be able to use GitHub Copilot in Terminal Chat!

Animated GIF of a user signing into GitHub Copilot to enable Terminal Chat to chat with GitHub Copilot

In the GIF above, you will see an end-to-end demo of the authorization flow and how to use Terminal Chat. You’ll also notice that Terminal Chat transformed into a GitHub Copilot branded experience after signing into GitHub!

Clicking on Terminal Chat’s suggestion will copy it to the input line of your terminal. Terminal Chat will not run the suggestion automatically for you– This way, you will have time to reason over the command before executing it 🙂

Terminal Chat only communicates to GitHub Copilot when the user sends a message. The chat history and name of the user’s active shell is also appended to the message sent to GitHub Copilot. For more information on how to use GitHub Copilot responsibly with Windows Terminal, see Responsible use of GitHub Copilot in Windows Terminal.

Tips & Tricks

Here are several ways that you can use GitHub Copilot in Terminal Chat!

  • Command suggestions: Ask for a command that you would like to use. Terminal Chat also adds name of the active shell to the prompt that you send to GitHub Copilot. This helps us get answers tailored to the shell that is in use– This means we don’t have to specify if we want answers for CMD or PowerShell (Yay! Less typing!)

  • Translate commands: Terminal Chat can also be used to “translate” commands. For example, you can ask “What’s touch in PowerShell?” or “How do I touch in PowerShell?” to get the suggestion of New-Item, a PowerShell command that is equivalent to the Linux / Unix-based touch command for creating a new file

  • Explain an error: If you’ve received an unfamiliar error response in your command line, you can ask Terminal Chat for an explanation and how to fix it. For example, “What is Error: getaddrinfo ENOTFOUND and how do I fix it?”

  • Send code suggestions to command-line text editors: If you’re using a command-line text editor in WSL (like nano or vi), you can ask Terminal Chat to generate code and send the code suggestion to the editor by clicking the “Copy” button. See the GIF below for a demo!

Let’s Build Together

For now, Terminal Chat is only available in Windows Terminal Canary. We are committed to transparency and listening to user feedback. We strongly believe that the inclusion of the open-source community will help us define the roadmap for our core product, Windows Terminal.

If you are interested in the AI experiences that we are building, then check out the feature/llm branch of the Windows Terminal repository or download the latest build of Windows Terminal Canary.

If you have a feature request or found a bug, then please submit a new Issue on our GitHub repository. Send us feedback! Help us grow! And let’s build together!

If you need to set Group Policies for Terminal Chat, see our Group Policy documentation.

Lastly, if you want to explore the other features you get with a GitHub Copilot subscription (which includes GitHub Copilot in Visual Studio Code and Visual Studio!) then check out the GitHub Copilot website for more info!

Thank you!

2023 Signatures

Author

Christopher Nguyen
Product Manager II, Windows Terminal

4 comments

  • Miroslav Moravek 2 weeks ago

    It would be great to have a shortcut to invoke the chat ui,
    focus the text box, let me type a question,
    and then using another shortcut to copy default command answer to clipboard or the window below and close the window

    this is in fact a terminal app, that should be most productive when used with keyboard

    • Yusen MO 2 weeks ago

      I completely agree with you; There’s a bit of inconvenience using it now.

  • Bill Sun

    It would be nice to have autocompletion in terminal as well.

  • Wes Higbee

    Great to see different provider options!