How to Install GitHub Copilot on VSCode?
Last Updated :
02 Jul, 2024
GitHub Copilot is a revolutionary AI-powered code completion tool developed by GitHub and OpenAI. It can help you write code faster and more efficiently by suggesting entire lines or blocks of code as you type.
If you're using Visual Studio Code (VSCode), installing GitHub Copilot can significantly enhance your coding experience. This article will guide you through the steps to install GitHub Copilot on VSCode.
Prerequisites
Before you begin, make sure you have the following:
- VSCode Installed: Download and install Visual Studio Code from the official website.
- GitHub Account: You need a GitHub account to use GitHub Copilot. If you don't have one, sign up at GitHub.
- GitHub Copilot Subscription: GitHub Copilot requires a subscription. You can sign up for a free trial or purchase a subscription on the GitHub Copilot page.
Step-by-Step Guide to Install GitHub Copilot on VSCode
Step 1: Open VS Code
On Windows, you can do so by searching for it in the Windows Search Bar. If you are unable to locate VS Code, install it using this tutorial for Windows and this tutorial for Linux.
Open VS CodeClick on the Extensions button, or use the shortcut: Ctrl + Shift + X (on Windows), Cmd + Shift + X (on Mac).
Click on ExtensionsStep 2: Open the Extensions View
Search for the extension 'GitHub Copilot' and then click on 'Install'.
Open the Extensions ViewStep 3: Search for GitHub Copilot
You may then be prompted to enter your GitHub credentials. Click on Sign in to GitHub, then click on Allow and enter your GitHub credentials.
Step 4: Install the GitHub Copilot Extension
Click the Install button next to the GitHub Copilot extension. VSCode will download and install the extension.
Install the GitHub Copilot Extension
Click on AllowStep 5: Sign In to GitHub
Once the extension is installed, you need to sign in to your GitHub account. You will see a prompt asking you to sign in. Click the Sign in with GitHub button. This will open a browser window where you can log in to your GitHub account and authorize GitHub Copilot.
Sign In to GitHubClick on "Join the waitlist" to be added to the waitlist for access to GitHub Copilot.
Step 6: Enable GitHub Copilot
After signing in, go back to VSCode. You may need to reload the window for the changes to take effect. You can do this by pressing Ctrl+Shift+P
(Windows/Linux) or Cmd+Shift+P
(Mac) to open the Command Palette, typing "Reload Window," and selecting the appropriate command.
Using GitHub Copilot
Once GitHub Copilot is installed and activated, it will start suggesting code as you type. Here are some tips on how to use it effectively:
- Accept Suggestions: Press
Tab
to accept a suggestion. - Cycle Through Suggestions: Use
Alt+[
and Alt+]
(Windows/Linux) or Option+[
and Option+]
(Mac) to cycle through suggestions. - Trigger Suggestions: Press
Ctrl+Space
(Windows/Linux) or Cmd+Space
(Mac) to manually trigger suggestions.