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 sign up for GitHub Copilot, 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 more in-depth information on how to use GitHub Copilot in a variety of environments, see "Getting Started."
Prerequisites
- GitHub Copilot es gratuito para los alumnos verificados y los responsables de mantener el código abierto.
- Si no eres alumno ni mantenedor de código abierto, puedes probar GitHub Copilot de manera gratuita con una prueba de 60 días. Después de la evaluación gratuita, necesitarás una suscripción de pago para continuar usándolo. Debes proporcionar información de facturación para iniciar una evaluación gratuita. Para obtener más información, consulta "Acerca de la facturación de GitHub Copilot".
- To use GitHub Copilot in Visual Studio Code, you must have Visual Studio Code installed. For more information, see the Visual Studio Code documentation.
Signing up for GitHub Copilot
Antes de empezar a usar GitHub Copilot, deberás configurar una evaluación gratuita o una suscripción.
-
En la esquina superior derecha de cualquier página, haga clic en la foto del perfil y, luego, en Settings (Configuración).

-
En la sección "Código, planificación y automatización" de la barra lateral, haz clic en GitHub Copilot.
-
En la página de configuración de GitHub Copilot, haz clic en Habilitar GitHub Copilot .

-
Elige si quieres pagar mensual o anualmente y haz clic en Continuar para obtener acceso a Copilot.
- Si tu cuenta personal cumple los criterios de una suscripción gratuita de GitHub Copilot en lugar de una prueba, se te dirigirá automáticamente al paso 6.

-
Sigue los pasos para confirmar los detalles del pago y, después, haz clic en Enviar.
-
Selecciona tus preferencias y, después, haz clic en Guardar y empezar.

Para cambiar estas preferencias más adelante, vuelve a la configuración de GitHub Copilot. Para obtener más información, consulta "Configuración de GitHub Copilot en Visual Studio Code".
Installing the GitHub Copilot extension for Visual Studio Code
To use GitHub Copilot, you must first install the Visual Studio Code extension.
- In the Visual Studio Code Marketplace, go to the GitHub Copilot extension page and click Install.

- A popup will appear, asking to open Visual Studio Code. Click Open Visual Studio Code.
- In the "Extension: GitHub Copilot" tab in Visual Studio Code, click Install.

- 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.

- If you have previously authorized Visual Studio Code in your GitHub account, GitHub Copilot will be automatically authorized.
- In your browser, GitHub will request the necessary permissions for GitHub Copilot. To approve these permissions, click Authorize Visual Studio Code.
- 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 "Enabling or disabling duplication detection."
GitHub Copilot proporciona sugerencias para numerosos lenguajes y una amplia variedad de marcos, pero funciona especialmente bien para Python, JavaScript, TypeScript, Ruby, Go, C# y C++. The following samples are in JavaScript, but other languages will work similarly.
-
Open Visual Studio Code.
-
En Visual Studio Code, crea un archivo de JavaScript ( *.js).
-
En el archivo de JavaScript, escriba el encabezado de función siguiente.
JavaScript function calculateDaysBetweenDates(begin, end) {GitHub Copilot will automatically suggest an entire function body in grayed text, as shown below. The exact suggestion may vary.

-
Para aceptar la sugerencia, presiona 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: 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.