Skip to main content

Inicio rápido para GitHub Copilot

GitHub Copilot puede ayudarte a trabajar porque te ofrece sugerencias insertadas mientras codificas.

¿Quién puede utilizar esta característica?

GitHub Copilot se pueden administrar a través de cuentas personales con GitHub Copilot Individual, a través de cuentas de la organización o empresa con GitHub Copilot Business, o a través de cuentas empresariales con GitHub Copilot Enterprise.

GitHub Copilot es gratis para los alumnos comprobados, profesores y los mantenedores de proyectos populares de código abierto. Para más información, consulta "Acerca de la facturación de 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.

You can use GitHub Copilot either through your personal account, with a GitHub Copilot Individual subscription, or through an organization or enterprise account, with a GitHub Copilot Business or GitHub Copilot Enterprise subscription. To use Copilot through an organization account, you must be assigned a GitHub Copilot seat by your organization.

This guide shows you how to set up a GitHub Copilot Individual subscription for your personal account, install the GitHub Copilot extension in Visual Studio Code, and get your first suggestion. For organization owners and enterprise owners, this guide also explains how to set up a GitHub Copilot Business or GitHub Copilot Enterprise subscription.

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 through your personal account, you will need to set up a free trial or subscription for GitHub Copilot Individual.

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 30-day trial.

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

  2. On the GitHub Copilot settings page, click Start free trial.

  3. Choose whether you want to pay monthly or yearly, and click Get access to GitHub 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 5.

  4. Follow the steps to enter and confirm your payment details, then click Submit.

  5. Select your preferences, then click Save and complete setup.

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

Installing the GitHub Copilot extension for Visual Studio Code

To use GitHub Copilot in Visual Studio Code, you must first install the Copilot 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++. GitHub Copilot can also assist in query generation for databases. 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.

Signing up for GitHub Copilot Business for your enterprise account

As an enterprise owner, you can add a GitHub Copilot Business subscription to your enterprise account. Owners of organizations that you have enabled for Copilot will then be able to assign GitHub Copilot seats to members of their organization. For more information, see "Managing access for Copilot in your organization."

Customers under a Microsoft Enterprise Agreement

If you're under a Microsoft Enterprise Agreement, you need to connect your Azure subscription ID to your enterprise account to enable and pay for GitHub Copilot. For more information, see "Connecting an Azure subscription."

Customers under a direct GitHub contract

  1. Go to the GitHub Copilot 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.

Signing up for GitHub Copilot Enterprise for your enterprise account

As an enterprise owner, you can add a GitHub Copilot Enterprise subscription to your enterprise account. Owners of organizations that you have enabled for Copilot will then be able to assign GitHub Copilot seats to members of their organization. For more information, see "Managing access for Copilot in your organization."

Customers under a Microsoft Enterprise Agreement

If you're under a Microsoft Enterprise Agreement, you need to connect your Azure subscription ID to your enterprise account to enable and pay for GitHub Copilot. For more information, see "Connecting an Azure subscription."

Customers under a direct GitHub contract

The process for signing up for GitHub Copilot Enterprise varies depending on whether your enterprise is new to GitHub Copilot, or you are upgrading from GitHub Copilot Business.

Signing up for GitHub Copilot Enterprise without GitHub Copilot Business

  1. In a browser, navigate to github.com/github-copilot/signup/plans.
  2. Select GitHub Copilot Enterprise, then click Enable Copilot Enterprise.
  3. Follow the prompts to complete the sign-up process.

Upgrading from GitHub Copilot Business to GitHub Copilot Enterprise

When you purchase Copilot Enterprise, all existing Copilot Business seats in your enterprise will be converted to the Copilot Enterprise plan and billed accordingly. You cannot have a combination of Copilot Enterprise and Copilot Business seats within the same enterprise.

  1. In the top-right corner of GitHub.com, click your profile photo, then click Your enterprises.

  2. In the list of enterprises, click the enterprise you want to view.

  3. In the enterprise account sidebar, click Policies.

  4. Under " Policies", click Copilot.

  5. In the "Access management" tab, in the section "Copilot Business is active in your enterprise," click Enable Copilot Enterprise.

  6. In the "Welcome to Copilot Enterprise" popup that's displayed, click Purchase Copilot Enterprise.

  7. Follow the prompts to complete the sign-up process.

Enabling GitHub Copilot for your enterprise account

Users can only use GitHub Copilot after they have been granted a Copilot seat by an organization they belong to.

As an enterprise owner, you must decide whether to allow all organizations in your enterprise the ability to grant GitHub Copilot seats to members, or only specific organizations. Initially, after purchasing GitHub Copilot Business or GitHub Copilot Enterprise, no organizations have the ability to grant GitHub Copilot seats, so you must enable this for some or all of your organizations.

  1. In the enterprise account sidebar, click Policies.

  2. Under " Policies", click Copilot.

  3. In the "Access management" tab, under "Manage organization access to GitHub Copilot," configure the access for your GitHub Copilot subscription.

    • To enable GitHub Copilot for all organizations in your enterprise, both current and future, select Allow for all organizations.
    • To enable GitHub Copilot for specific organizations, select Allow for specific organizations.
  4. If you selected Allow 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.

    When you enable an organization, the owners of that organization will receive an email with instructions on how to enable GitHub Copilot for members of the organization.

  5. Click the Policies tab.

  6. Under "Suggestions matching public code," click the dropdown menu and select the policy for managing the use of GitHub Copilot suggestions that match public code in your enterprise.

    • To block GitHub Copilot suggestions that match public code, select Blocked.
    • To allow GitHub Copilot suggestions that match public code, select Allowed.
    • To allow each of your organizations to set their own policy, select No policy.
  7. If you have a GitHub Copilot Enterprise subscription, under "Copilot in GitHub.com," click the dropdown menu and select the policy for managing the use of Copilot in GitHub.com.

    • To allow each of your organizations to set their own policy, select No policy.
    • To enable Copilot Chat for all organizations in your enterprise, select Enabled.
    • To disable Copilot Chat for all organizations in your enterprise, select Disabled.

    If you select Enabled, use the check boxes that are displayed to specify whether you want to:

    • Allow Copilot Chat to use Bing search when responding to questions on GitHub.com.
    • Allow GitHub to collect user feedback, optionally submitted after using Copilot to generate a pull request summary.

    For more information, see "Enabling GitHub Copilot Enterprise features."

  8. Under "Copilot Chat in the IDE," click the dropdown menu and select the policy for managing the use of Copilot Chat in code editor applications.

    • To allow each of your organizations to set their own policy, select No policy.
    • To enable Copilot Chat for all organizations in your enterprise, select Enabled.
    • To disable Copilot Chat for all organizations in your enterprise, select Disabled.
  9. Under "Copilot in the CLI," click the dropdown menu and select the policy for managing the use of Copilot in the terminal.

    • To allow each of your organizations to set their own policy, select No policy.
    • To enable Copilot in the CLI for all organizations in your enterprise, select Enabled.
    • To disable Copilot in the CLI for all organizations in your enterprise, select Disabled.

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.

Further reading