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
- L’utilisation de GitHub Copilot est gratuite pour les étudiants vérifiés et les gestionnaires open source.
- Si vous n’êtes pas un étudiant ou gestionnaire open source, vous pouvez essayer GitHub Copilot gratuitement avec une version d’évaluation de 60 jours. Après l’évaluation gratuite, vous aurez besoin d’un abonnement payant pour continuer à l’utiliser. Vous devez fournir des informations de facturation pour commencer une évaluation gratuite. Pour plus d’informations, consultez « À propos de la facturation pour 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
Avant de pouvoir commencer à utiliser GitHub Copilot, vous devrez mettre en place un essai gratuit ou un abonnement.
-
Dans le coin supérieur droit d’une page, cliquez sur votre photo de profil, puis sur Paramètres.

-
Dans la section « Code, planification et automatisation » de la barre latérale, cliquez sur GitHub Copilot.
-
Sur la page des paramètres de GitHub Copilot, cliquez sur Activer GitHub Copilot .

-
Choisissez si vous voulez payer par mois ou par an, et cliquez sur Continuer pour obtenir l’accès à Copilot.
- Si votre compte personnel répond aux critères d’un abonnement gratuit GitHub Copilot plutôt qu’un essai, vous passerez automatiquement à l’étape 6.

-
Suivez les étapes pour confirmer les détails de votre paiement, puis cliquez sur Envoyer.
-
Sélectionnez vos préférences, puis cliquez sur Enregistrer et commencer.

Vous pouvez modifier ces préférences ultérieurement en retournant à vos paramètres GitHub Copilot. Pour plus d’informations, consultez « Configuration de GitHub Copilot dans 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 fournit des suggestions pour de nombreux langages et un large éventail d’infrastructures, mais fonctionnent particulièrement bien pour Python, JavaScript, TypeScript, Ruby, Go, C# et C++. The following samples are in JavaScript, but other languages will work similarly.
-
Open Visual Studio Code.
-
Dans Visual Studio Code, créez un fichier JavaScript ( *.js).
-
Dans le fichier JavaScript, tapez l’en-tête de fonction suivant.
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.

-
Pour accepter la suggestion, appuyez sur 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.