Getting started with GitHub Copilot: a beginner's guide
Learn how to let AI write code for you safely, right inside your editor, so you can finish small projects faster.
By the end of this guide, you’ll have GitHub Copilot installed and ready to type real code for you inside Visual Studio Code. You'll try it on a tiny "hello world" file, so you can see the magic without risk. This is perfect for anyone in a business or work setting who needs to write a bit of code but isn't a full-time developer.
- A free GitHub account: This is an online account that helps you manage code projects. Signing up is quick, usually under a minute.
- A GitHub Copilot subscription: After a free trial, Copilot requires a paid subscription. You’ll need to ensure you have an active subscription or are within your trial period to use it.
- Visual Studio Code (VS Code) installed: This is a free code editor where Copilot lives. Download it from the official website and install it on your computer (Windows, Mac, or Linux).
- Time needed: Allow about 10-15 minutes to follow all the steps.
Install the Copilot extension
First, open Visual Studio Code on your computer. You'll see a clean window, usually with a welcome screen. On the far left side, look for the Activity bar — this is a vertical row of icons. Find and click the Extensions icon, which looks like four connected squares. This will open the Extensions view. In the search bar at the top, type "Copilot" and press Enter. You should see an extension named GitHub Copilot by "GitHub" itself. Click the "Install" button next to it.
You'll know it worked when: The "Install" button changes to "Manage", and a new, distinct GitHub Copilot icon (a stylised half-circle) appears in your Activity bar. If you don't see the Extensions icon, you can usually press Ctrl+Shift+X (Windows/Linux) or Cmd+Shift+X (Mac) to open it.

Sign in with your GitHub account
Now that the extension is installed, you need to link it to your GitHub account. Click the newly appeared GitHub Copilot icon in your Activity bar on the left. This will typically open a sidebar panel related to Copilot. Within this panel, you should see a prompt to "Sign in to GitHub" or "Authorise GitHub Copilot". Click on this. What happens next is that a new browser window or tab will automatically open, directing you to the GitHub website to complete the sign-in process. Use the same GitHub account details you prepared earlier.
You'll know it worked when: Your browser displays a confirmation message like "GitHub Copilot is ready" or "Authorisation successful". Close the browser tab and return to Visual Studio Code, where the Copilot panel will likely update to show you are signed in. If the browser window doesn't appear, check if your browser's pop-up blocker is active and temporarily disable it for this site.

Turn on the AI helper in a new file
With Copilot signed in, let's create a space for it to work. In VS Code, go to File > Open Folder... (or File > Open... on Mac) and choose an empty folder on your computer. If you don't have one, just create a new empty folder anywhere, then open it. Once a folder is open, look in the Explorer panel (the top icon in the Activity bar, resembling two overlapping sheets of paper). Right-click inside the Explorer panel's empty space, or click the "New File" icon (a blank page with a plus sign) at the top of the Explorer panel. Name the new file hello.py and press Enter. The .py part tells VS Code it's a Python file.
You'll know it worked when: An empty hello.py file opens in the main editing area of VS Code. VS Code might also suggest installing a "Python extension" – if so, click "Install" to help it understand Python code better. If you have trouble opening a folder, try "File > New Text File" to just get started, though working in a folder is usually best.

Ask Copilot to write your first line
Now for the exciting part! With hello.py open and empty, type the following exact line, which is a comment (a note in code that the computer ignores but a human can read) explaining what you want the AI to do. After typing the line, press your Enter key.
# write a function that prints hello world
What happens next is that Copilot, acting as your AI assistant, will process your comment. After a brief pause (usually a second or two), you'll see a greyed-out suggestion, often called "ghost text," appear right after your cursor. This is Copilot’s suggestion for the code. To accept this code, press your Tab key.
You'll know it worked when: The grey ghost text suggestion (which should be Python code for printing "Hello, world!") is inserted into your file. If the ghost text doesn't appear, check the bottom-right status bar of VS Code for a small Copilot icon; if it has a spinning circle, it's still thinking. If it's greyed out, it might be inactive – try typing again or restarting VS Code.

Run your first AI-generated code
After accepting the code in hello.py, you'll have a function defined. Now, let's make it actually run! Go to the end of the hello.py file, on a new line, and type the name of the function Copilot created (it's usually print_hello_world()) to call it. Now, to run the code, go to the top menu in VS Code and click Run > Run Without Debugging, or simply press the F5 key (this is a common shortcut). If VS Code asks you to select an environment, choose "Python File" or "Python Debugger".
You'll know it worked when: A Terminal panel opens at the bottom of VS Code, and you see the text "Hello, world!" (or similar, depending on Copilot's exact output) displayed there. This confirms your AI-generated code successfully ran. If it looks different, ensure you have the Python extension installed (from Step 3's suggestion) and that you selected "Python File" when prompted to run. Copilot cannot send your output anywhere else; it only suggests code within the editor.

- No active Copilot subscription or trial: Copilot is a paid service after a free trial, and it won't work without an active subscription linked to your GitHub account.
- Fix: Ensure your GitHub Copilot subscription is active by visiting the GitHub Copilot settings page in your browser.
- Copilot suggestions aren't appearing: Sometimes Copilot needs a moment to 'wake up', or there might be an issue with your internet connection or VS Code configuration.
- Fix: Wait a few seconds after typing your prompt. Check the Copilot icon in the VS Code status bar (bottom right); if it's spinning or shows an error, try restarting VS Code or checking your internet connection.
- Blindly accepting suggestions: Copilot provides suggestions, but they might not always be exactly what you need, or they could contain minor errors.
- Fix: Always read the ghost text carefully before pressing
Tab. If it's not quite right, you can ignore it by continuing to type, or delete it and rephrase your comment to guide Copilot towards a better answer.
- Fix: Always read the ghost text carefully before pressing
Open VS Code, create a new file named calculate.py. Inside it, type # create a function that adds two numbers and returns the sum, then press Enter. Accept Copilot's suggestion, then add a line like result = add_numbers(5, 3) and print(result). Save the file, press F5 to run it, and see the result in the terminal. You just wrote – and ran – your first AI-assisted functional code in under two minutes!
✦ Original step-by-step guide by AI World Co.'s AI editorial team. Written in plain language, reviewed for accuracy.
← Back to all stories