
Getting Started Guide
How to Use GitHub Copilot
A practical guide to get you up and running with GitHub Copilot. Written by Delv Editorial, Delv Team.
Getting started with GitHub Copilot
In this guide, you'll learn how to set up GitHub Copilot and use it to enhance your coding experience. By the end, you'll be able to receive intelligent code suggestions directly within your code editor.Step 1: Sign up and set up
- Go to GitHub Copilot.
- Click on the Sign up for Copilot button.
- If you do not have a GitHub account, create one. If you do, log in.
- Choose your subscription plan (Individual, Business, or Enterprise). Students can sign up for free.
- Follow the prompts to enter payment details if required.
- Once signed up, install the GitHub Copilot extension for your code editor. For Visual Studio Code, go to the Extensions view (click on the square icon on the sidebar) and search for "GitHub Copilot." Click Install.
Step 2: Your first code suggestion
- Open your code editor and create a new file or open an existing project.
- Start typing a function or comment about what you want to achieve. For example, type
// function to add two numbers. - After typing, you’ll see suggestions pop up. Press Tab to accept a suggestion or Esc to dismiss it.
- You can also trigger suggestions manually by pressing Ctrl + Space (Windows) or Cmd + Space (Mac).
Step 3: Get better results
- Be specific in your comments and function names. For example, instead of
// function, use// function to calculate the factorial of a number. - Use descriptive variable names to help Copilot understand the context better.
- Review and modify suggestions as needed. Copilot may not always generate perfect code, so always test the output.
Pro tip
Use the "Copilot" tab that appears in the UI after you start typing. This will give you a list of suggestions and allow you to cycle through them more easily.Common mistake to avoid
Avoid being vague in your comments or code. For instance, if you write// do something, Copilot may not provide useful suggestions. Always aim to provide clear context for better results.