Before you start
- Visual Studio Code (Windows, Mac or Linux)
- A free GitHub account
- An internet connection
Method 1 Install VS Code and sign in to Copilot
Students, teachers and maintainers of popular open-source projects may qualify for free Copilot Pro through GitHub Education or GitHub’s open-source programme.
-
Step 1: Install Visual Studio Code
Download VS Code from code.visualstudio.com and install it. If you already have it, update to the latest version (Help > Check for Updates on Windows and Linux, Code > Check for Updates on Mac).
-
Step 2: Create a GitHub account
If you don’t have one, sign up for free at github.com. Turn on two-factor authentication to protect your code.
-
Step 3: Turn on AI features
In VS Code, hover over the Copilot icon in the Status Bar (bottom of the window) and select Use AI Features.
-
Step 4: Sign in
Choose to sign in with GitHub, approve the request in your browser, and return to VS Code. If you don’t already have a Copilot subscription, you’re signed up to Copilot Free, which includes a monthly allowance of suggestions and chat.
Method 2 Use inline suggestions as you type
-
Step 1: Start typing
Open a code file and start writing a function, or type a descriptive comment such as
// function that validates an email address. Copilot shows a suggestion in grey text. -
Step 2: Accept or dismiss
Press Tab to accept the whole suggestion, Esc to dismiss it, or Ctrl+Right Arrow (Cmd+Right Arrow on Mac) to accept it one word at a time.
-
Step 3: See other options
Hover over the suggestion to switch between alternatives when Copilot offers more than one.
-
Step 4: Follow next edit suggestions
After you change something, Copilot may suggest a related edit elsewhere in the file, such as renaming a variable everywhere. Press Tab to jump to it and Tab again to accept.
Method 3 Ask questions and make changes in Chat
-
Step 1: Open the Chat view
Press Ctrl+Alt+I (Ctrl+Cmd+I on Mac) or select the chat icon at the top of the window.
-
Step 2: Ask about your code
Ask things like “Explain what this file does”, “Why does this function return undefined?” or “What’s the best way to read a CSV file in Python?” Add context by typing # to reference a file or selection, or drag files into the chat.
-
Step 3: Let the agent make changes
Ask for a task such as “Add input validation to the signup form and write tests for it.” In Agent mode, Copilot plans the work, edits several files and can run terminal commands, asking your permission first.
-
Step 4: Plan bigger tasks
For larger features, choose Plan (where available) or ask the agent to propose an approach before editing, then approve the plan.
-
Step 5: Review and keep
Changed files are highlighted. Review the differences, then select Keep or Undo for each change.
Method 4 Use inline chat for quick edits
-
Step 1: Select some code
Highlight a function or block in the editor.
-
Step 2: Open inline chat
Press Ctrl+I (Cmd+I on Mac) and type an instruction, such as “Convert this to async/await” or “Add comments explaining each step.”
-
Step 3: Accept or discard
Copilot shows the change in place. Accept it, or discard it and try a clearer instruction.
| Goal | Try asking |
|---|---|
| Understand code | Explain this function line by line for a beginner |
| Fix an error | Here’s the error from the terminal. Find the cause and fix it |
| Write tests | Write unit tests for this file covering edge cases |
| Improve code | Refactor this to be more readable without changing its behaviour |
| Documentation | Write a README section explaining how to install and run this project |
| Commit message | Generate a commit message for my staged changes (sparkle icon in Source Control) |
Troubleshooting
No suggestions appear
Check the Copilot icon in the Status Bar: make sure you’re signed in and suggestions aren’t disabled for this language. Check you haven’t used up your Copilot Free allowance for the month.
Sign-in doesn’t complete
Allow VS Code to open the browser link, make sure you’re signed in to the right GitHub account, then return to VS Code. Behind a company proxy or firewall, ask IT to allow GitHub Copilot.
“You’ve reached your monthly limit”
Copilot Free has monthly limits. Wait for the reset date, or upgrade to a paid plan in your GitHub settings.
Copilot keeps suggesting the wrong thing
Write a clearer comment describing what you want, open related files so it has more context, or ask in Chat with specific files referenced using #.
Frequently asked questions
Is GitHub Copilot free?
Yes, Copilot Free gives individual developers a monthly allowance of code suggestions and chat at no cost. Paid plans offer more usage and extra models.
Which languages does Copilot support?
It works with almost every popular language, including Python, JavaScript, TypeScript, Java, C#, C++, Go, PHP and Ruby, plus HTML, CSS and SQL.
Does Copilot use my code to train models?
You can control how GitHub uses your data in your Copilot settings on github.com. Business and Enterprise plans don’t use customers’ code for training.
Can beginners use Copilot to learn programming?
Yes, especially for explanations. But try to write code yourself first and use Copilot to check and explain it; accepting every suggestion without understanding it slows your learning.
Summary
Install VS Code, select the Copilot icon, choose Use AI Features and sign in with GitHub to get Copilot Free. Press Tab to accept inline suggestions, use the Chat view or Ctrl+I to ask questions and request changes, and let the agent handle larger tasks. Review every change, test it, and keep secrets out of your prompts.