Skip to main content

Quickstart for GitHub Copilot

GitHub Copilot can help you work, by offering inline suggestions as you code.

GitHub Copilot can be managed through personal accounts with GitHub Copilot for Individuals or through organization or enterprise accounts with GitHub Copilot for Business.

GitHub Copilot is free to use for verified students, teachers, and maintainers of popular open source projects. For more information, see "About billing for GitHub Copilot."

Introduction

GitHub Copilot is an AI pair programmer. You can use GitHub Copilot to get suggestions for whole lines or entire functions right inside your editor.

This guide will show you how to set up a GitHub Copilot subscription for your personal , organization, or enterprise account, install the GitHub Copilot extension in Visual Studio Code, and get your first suggestion. For more information on GitHub Copilot, see "About GitHub Copilot for Individuals." For more in-depth information on how to use GitHub Copilot in a variety of environments, see "Getting started with GitHub Copilot."

Signing up for GitHub Copilot for your personal account

Before you can start using GitHub Copilot, you will need to set up a free trial or subscription for your personal account.

Note: If you were part of the free GitHub Copilot technical preview that was run between July 2021 and June 2022, you are not eligible for a 60-day trial.

  1. In the upper-right corner of any page, click your profile photo, then click Settings.

    Screenshot of GitHub's account menu showing options for users to view and edit their profile, content, and settings. The menu item "Settings" is outlined in dark orange.

  2. In the "Code, planning, and automation" section of the sidebar, click GitHub Copilot.

  3. On the GitHub Copilot settings page, click Enable GitHub Copilot.

  4. Choose whether you want to pay monthly or yearly, and click Continue to get access to Copilot.

    • If your personal account meets the criteria for a free GitHub Copilot subscription instead of a trial or paid subscription, you will automatically be taken to step 6.
  5. Follow the steps to confirm your payment details, then click Submit.

  6. Select your preferences, then click Save and get started.

    You can change these preferences at a later time by returning to your GitHub Copilot settings. For more information, see "Configuring GitHub Copilot in Visual Studio Code."

Note: As a member of an organization owned by a GitHub Enterprise Cloud account with a GitHub Copilot subscription, you must be assigned a GitHub Copilot seat by your organization before you can use GitHub Copilot.

Signing up for GitHub Copilot for your organization or enterprise account

Signing up for GitHub Copilot for your enterprise account

  1. Go to the GitHub Copilot for Business sign up page.

  2. To purchase GitHub Copilot for your enterprise, select Enable GitHub Copilot at an enterprise level and click Continue.

  3. Select the enterprise for which you want to purchase GitHub Copilot and click Continue.

  4. Follow the steps to confirm your payment details, then click Save.

    If you don't have a payment method on file, you'll be prompted to add one.

  5. Click the dropdown menu and select the policy for managing the use of GitHub Copilot suggestions that match public code in your enterprise. You can change the policy later by returning to your GitHub Copilot for Business settings.

    • To allow GitHub Copilot suggestions matching public code, select Allowed.
    • To block GitHub Copilot suggestions matching public code, select Blocked.
    • To allow each of your organizations to set their own policy on the use of GitHub Copilot suggestions matching public code, select No policy (let each organization decide).
  6. Configure the access for your GitHub Copilot subscription.

    • To enable GitHub Copilot for all organizations in your enterprise, both current and future, select Enable for all organizations.
    • To enable GitHub Copilot for specific organizations, select Enable for specific organizations.
  7. If you selected Enable for specific organizations, select the organizations you want to enable GitHub Copilot for. Alternatively, you can select the organizations you want to disable GitHub Copilot access for.

    • Click Set organization permissions and select Enable or Disable to grant or deny GitHub Copilot access for the specified organizations.
  8. To finish setting up your GitHub Copilot for Business subscription, click Save and finish. Organization administrators will receive an email with instructions on how to add members to GitHub Copilot.

Signing up for GitHub Copilot for your organization account

Before you can start using GitHub Copilot in your organization account, you will need to set up a subscription.

  1. Go to the GitHub Copilot for Business sign up page.

  2. Select an organization for which you want to purchase GitHub Copilot and click Continue.

  3. Follow the steps to confirm your payment details, then click Save.

    If you don't have a payment method on file, you'll be prompted to add one.

  4. In the "Public code suggestions" dropdown, select Allow or Block to allow or block suggestions that match public code, and click Save and continue. You can change these preferences later by returning to your GitHub Copilot settings.

  5. Either grant access to GitHub Copilot for all current and future users in your organization, or for specific users in your organization.

    • If you selected Allow for all members, click Confirm in the "Confirm seat assignment" dialog to confirm that you want to enable GitHub Copilot for all current and future users in your organization.
    • If you selected Selected teams/users, you can choose Add people or Add team.
      • If you selected Add people, in the "Enable GitHub Copilot access for selected members of ORGANIZATION" dialog, you can either search for individual members, or you can add members in bulk by uploading a CSV file.
      • If you selected Add team, in the "Enable GitHub Copilot access for selected teams of ORGANIZATION" dialog, start typing the team name in the search bar, select the team you want to add and click Add team(s) to access list.
  6. To finish setting up your GitHub Copilot for Business subscription, click Save and finish. Organization members will receive an email with instructions on how to start using GitHub Copilot.

Installing the GitHub Copilot extension for Visual Studio Code

To use GitHub Copilot, you must first install the Visual Studio Code extension.

  1. In the Visual Studio Code Marketplace, go to the GitHub Copilot extension page and click Install.

  2. A popup will appear, asking to open Visual Studio Code. Click Open Visual Studio Code.

  3. In the "Extension: GitHub Copilot" tab in Visual Studio Code, click Install.

  4. If you have not previously authorized Visual Studio Code in your GitHub account, you will be prompted to sign in to GitHub in Visual Studio Code.

    • If you have previously authorized Visual Studio Code in your GitHub account, GitHub Copilot will be automatically authorized.
  5. In your browser, GitHub will request the necessary permissions for GitHub Copilot. To approve these permissions, click Authorize Visual Studio Code.

  6. In Visual Studio Code, in the "Visual Studio Code" dialogue box, to confirm the authentication, click Open.

Getting your first suggestion

Note: If you have duplication detection enabled for GitHub Copilot, you may receive limited suggestions, or no suggestions, when using the code examples provided. As an alternative, you can start by typing your own code to see suggestions from GitHub Copilot. For more information on duplication detection, see "Configuring GitHub Copilot settings on GitHub.com."

GitHub Copilot provides suggestions for numerous languages and a wide variety of frameworks, but works especially well for Python, JavaScript, TypeScript, Ruby, Go, C# and C++. The following samples are in JavaScript, but other languages will work similarly.

  1. Open Visual Studio Code.

  2. In Visual Studio Code, create a new JavaScript (*.js) file.

  3. In the JavaScript file, type the following function header.

    JavaScript
    function calculateDaysBetweenDates(begin, end) {

    GitHub Copilot will automatically suggest an entire function body in grayed text. The exact suggestion may vary.

  4. To accept the suggestion, press Tab.

Next Steps

You successfully installed GitHub Copilot and received your first suggestion, but that's just the beginning! Here are some helpful resources for taking your next steps with GitHub Copilot.

  • Getting started with GitHub Copilot: You've learned how to get your first suggestion in Visual Studio Code. These guides show you how to set up and navigate the various functions of GitHub Copilot across all of the supported environments.
  • GitHub Copilot: See practical examples of how GitHub Copilot can help you work.
  • Configuring GitHub Copilot: These guides provide details on how to configure GitHub Copilot to your personal preferences.

Further reading