Skip to content
ChaiBytes

How to Set Up GitHub Copilot in VS Code and Write Your First Lines of Code

You will be able to sign in to GitHub Copilot in Visual Studio Code, start a chat session, and try your first small AI-assisted coding task.

By Ali RazaOfficial admin

3 min read 2 views

Share

What you need

  • A GitHub account. Copilot in VS Code works with your GitHub account, so create or use one before you start [1].
  • Visual Studio Code installed on your computer.
  • A small practice folder on your computer, for example a folder called my-first-project. The /init command looks at the codebase, so open the folder you want to practise in.
  • Optional: a Copilot subscription. If you do not have one, you can sign up for the Copilot Free plan [1].

Step by step

  1. Find the Copilot icon. Look at the Status Bar at the bottom of the VS Code window and hover over the Copilot icon. This shows you the Copilot options.

  2. Select Use AI Features. This starts the setup process.

  3. Choose a sign-in method. Follow the prompts to sign in with your GitHub account. You can also sign in from the Accounts menu in the Activity Bar, or run the GitHub Copilot: Sign in command from the Command Palette, which opens with Ctrl+Shift+P on Windows and Linux.

  4. Check which plan you are on. If your GitHub account already has a Copilot subscription, VS Code uses it. If not, you are signed up for the Copilot Free plan, which includes a monthly allowance of inline suggestions and AI credits [1].

  5. Read the telemetry settings. Telemetry is turned on by default in the free version. If you prefer not to share usage data, you can set the telemetry.telemetryLevel setting to off, or adjust telemetry and code suggestion options in Copilot Settings [1].

  6. Open your practice folder. Open the folder in VS Code so that the project is ready for Copilot to work with.

  7. Start a chat session and type /init. Type /init in the chat. This creates starter custom instructions for your project. The instructions record coding practices that help AI-generated code match your project [1].

  8. Ask for a small piece of code. Here is an example for a beginner who wants a first program. Copy this prompt into the chat:

Write a short program that asks for my name and prints a greeting. Explain each line in plain English.
  1. Read the answer carefully. Only copy lines into your file after you understand what they do. If something is unclear, ask a follow-up question in the same chat. In one source, a developer asked Copilot for guidance after an error, applied the suggested change, then asked again about a related setting before redeploying [2].

  2. Test the result yourself. Run or check your code and confirm it does what you expect before you rely on it.

  3. Try the agents quickstart. Once you are comfortable with chat, follow the agents quickstart mentioned in the setup guide to complete a first coding task with an AI agent in VS Code [1].

Tips and common mistakes

  • Using the wrong account. If your Copilot subscription belongs to another GitHub account, open the Accounts menu in the Activity Bar, sign out of the current account, and sign in with the correct one [1].
  • Mixing work and personal accounts. You can use different GitHub accounts for Copilot per VS Code workspace or profile. The setting is saved for each workspace and profile [1].
  • Hiding AI features. If you do not want chat or inline suggestions, the chat.disableAIFeatures setting can disable and hide them. You can set it at the workspace or user level [1].
  • Trusting the first answer. Suggestions can be incomplete. In the Azure example, the developer had to ask again about a missing configuration value before the fix worked [2].
  • Skipping /init. Type /init inside a chat session, not in the editor, so that the starter instructions are created.

Use it responsibly

Always check AI answers before you use them, especially code that you plan to run on a real computer or share with others. Do not paste private information into chat, such as passwords, bank details, personal records or confidential client material. Follow the rules of your workplace or school about AI tools. Review the service’s own terms, including its telemetry and data-use details, before you send project content. Keep your GitHub account secure by using a strong, unique password, turning on account protection where available, and signing out on shared computers.

Sources

  1. 1. Set up Visual Studio Code with Copilot — code.visualstudio.com
  2. 2. GitHub Copilot for Azure: Deploy an AI RAG App to ACA using AZD | Microsoft Community Hub — techcommunity.microsoft.com

Drafted with AI assistance from the reports above and checked automatically for sourcing. Always confirm dates, fees and requirements on the official website before acting.

Was this helpful?

Comments

No comments yet. Share a question or what you know.

Leave a comment

Be respectful. Comments with links are reviewed before they appear. Your email is used only to contact you about your comment.