Getting started with GitHub Copilot in VS Code#
This appendix introduces the GitHub Copilot and VS Code setup used for AI-assisted programming in MQB. It supports the AI-assisted programming in biology chapter and lecture.
As you gain experience, you can explore other AI coding tools, such as OpenAI’s Codex or Claude Code.
If you prefer RStudio for your own R work, see the optional RStudio setup.
Before you start#
Set up VS Code for MQB and Python for the check below.
Choose an access route#
GitHub hosts code; GitHub Copilot provides AI assistance with coding. Having a GitHub account does not mean you have Copilot access. Check Copilot settings for the account you want to use.
Important
If you are preparing for a taught session, apply for Copilot access at least ten days beforehand. Approval can take time, and you may still need to activate Copilot afterwards.
Your situation |
Next action |
|---|---|
You already have Copilot access |
Use the GitHub account with that access when you sign in through VS Code. |
You are an eligible student |
Apply for GitHub Education benefits, then activate Copilot Student as described below. |
Your institution or employer provides access |
Follow its instructions and check that a licence has been assigned to your account. Ask its support team about any restrictions. |
You do not have access yet |
Check whether your account qualifies for Copilot Free in VS Code. If you cannot get access, follow the troubleshooting steps below. |
For an MQB class, do not buy a subscription to complete setup. Tell the teaching team if you cannot get access or have reached your usage limit. Plans and allowances change; check the current GitHub plan guide.
Eligible students#
In your web browser:
Sign in to the GitHub account you want to use, then open Education benefits.
If you are not yet verified, start an application and follow GitHub’s evidence requirements. Check student eligibility and application instructions if you are unsure whether you qualify.
After GitHub verifies your student status, return to Education benefits and follow the prompts to activate Copilot Student. See GitHub’s activation and troubleshooting guide if you need help.
Check Copilot settings again. If you still see only a trial or a payment page, consult the guide’s troubleshooting section.
If you are at Imperial College London#
Start with ICL’s GitHub Copilot information page for an overview of code completion, chat and the supported tools. Then follow ICL’s access instructions for your role:
Undergraduate and postgraduate students: apply through GitHub Education for free student access, then complete the activation steps above.
Postgraduates seeking a Business licence for research: first agree funding with your department or project. Follow the paid-billing process, then submit the licence request after the Azure subscription has been created.
Centrally funded staff: sign in to the ICL GitHub organisation and submit the licence request. ICT initially funds usage within its fair usage policy; additional usage requires paid billing.
Externally funded staff: arrange funding through a cost code and follow the paid-billing process before submitting the licence request. Check your funding category with your line manager if unsure.
Important
You must belong to the ICL GitHub organisation to use the institutional licence request form. Joining the organisation does not automatically activate Copilot. GitHub Education verification is a separate process. Once Copilot is active, use the same GitHub account in VS Code.
If you are not at ICL, follow the student instructions above or ask your institution or employer about access. The VS Code setup and checks below are the same whichever route you use.
Sign in through VS Code#
Warning
Before sending coursework to Copilot, check the assignment brief: may you use AI, and how should you acknowledge it? For research, check your institution’s and project’s rules on sending code or data to an external AI service.
For this setup, use a separate practice project with made-up data. Do not include passwords, access tokens, other people’s work or restricted research data.
Create a separate folder called
copilot-practice. Inside it, createcode/,data/andresults/folders and aREADME.mdfile. Use File → Open Folder… to opencopilot-practicein VS Code. Do not use your coursework repository or the downloaded MQB book source. See Organising your learning project for the folder layout.Follow the current VS Code Copilot setup guide. Select the Copilot status-bar control, choose Use AI Features if offered, and complete GitHub sign-in in the browser. Use the account whose access you checked above.
If prompted to install or enable Copilot, follow VS Code’s instructions and check that the extension is published by GitHub. Ask IT for help if your computer blocks installation. The MQB editor guide covers Python and R language support.
Open the Accounts menu in VS Code and confirm the account used for Copilot. If you have several GitHub accounts, the account-switching instructions explain how to select another one.
VS Code can include selected code and other files with your request. Check the files and context listed in chat before sending it. A private repository restricts who can see your files on GitHub. It does not give you permission to share them with Copilot: your coursework and research rules still apply.
Copilot controls#
Before sending your first request, find the mode, model and permissions controls.
Open the Chat view from VS Code’s Chat menu. Find the mode/agent picker beside the message box and choose Ask. If a Session Target control appears, use Copilot for these setup instructions. See the Chat view guide if your layout differs.
Open the model picker and choose Auto. Leave thinking effort at its default. See VS Code’s model controls for the current layout.
Before an Agent task, choose Manual permissions. If the setting is hidden in a narrow Chat panel, click the speech-bubble icon below the message box to reveal it, or widen the panel. Check which actions are already approved to run without asking you. See the permissions guide.
GitHub currently lists Free and Student as Auto-only plans. Check your plan and remaining allowance in Copilot settings, and consult the current plan comparison.
Check it with a small prediction#
This exercise checks two things: can Python run your script, and can you check Copilot’s explanation of the result?
Predict and run locally#
In VS Code, create code/copilot_setup_check.py inside copilot-practice and save this deliberately imperfect example:
heights_cm = [8, 12, 10, 15]
threshold_cm = 10
count = sum(height >= threshold_cm for height in heights_cm)
print(count)
The question is: how many heights are strictly greater than 10 cm? Work out your answer before running the code. Should a height of exactly 10 cm count?
Open Terminal → New Terminal. From the copilot-practice folder, run:
python3 code/copilot_setup_check.py
If you normally run Python with python, use that command instead.
The script prints 3: it counts 12, 10 and 15. But our question excludes 10, so the answer should be 2. The code runs, but it answers the wrong question.
Ask Copilot#
Note
If Copilot is unavailable, follow the troubleshooting steps below. Return to this exercise once access is working.
Select the four lines of code, right-click the selection and choose Add Selection to Chat. Check that an attachment above the prompt box shows the filename and selected line range, such as copilot_setup_check.py:1-4. Then ask:
My question is how many heights are strictly greater than 10 cm. I predicted two, but this code prints three. Explain which value accounts for the difference and why. Do not edit files or run commands.
Check Copilot’s explanation against the list: which value should have been excluded?
Correct and check the code#
Change >= to > yourself, save the file and run it again. It should now print 2. Keeping the threshold at 10, try a list containing only [10], then an empty list ([]). Both should print 0. Finally, restore the original list.
To try an inline suggestion, add a comment such as # Count heights strictly greater than 10 cm. Copilot will suggest some code to insert there. Read the suggested code before accepting it. If no suggestion appears, try the chat check above or the troubleshooting steps below.
If something does not work#
Symptom |
What to check |
|---|---|
Python cannot run the file |
Check the saved filename, project folder and Python command using the MQB editor checks. Get the script running before troubleshooting Copilot. |
GitHub has verified your student status, but Copilot is missing |
Check that you have activated Copilot Student. See GitHub’s student-benefit troubleshooting. |
VS Code uses the wrong account |
Compare the account in the browser’s Copilot settings with the one selected for Copilot in VS Code. Follow the official account-switching steps above. |
Copilot or chat is unavailable |
Check that Copilot is enabled in VS Code and that your organisation allows chat. See GitHub’s troubleshooting guide. |
Only Auto is available, or a model is missing |
Check the signed-in account, the current plan comparison and organisation restrictions. Do not relax security settings to obtain another model. |
Your mode picker differs from a tutorial |
Use the current guides linked above. For the setup check, use Ask. The chapter explains the other modes and legacy Edit option. |
Access worked, then requests stopped |
Read the error message and check your usage allowance. If you have reached a limit, tell the teaching team. For other errors, follow GitHub’s troubleshooting guide above. |
You cannot install or enable Copilot on a course machine |
Ask teaching staff or IT for help. |
If you are still waiting for access, tell the teaching team before the session. At ICL, contact ICT support for help with institutional access. For GitHub Education problems, follow the support instructions in the student-verification guide above.
When reporting a problem, include your operating system, VS Code version, relevant extension versions, the step that failed and the error text. Remove passwords, tokens and personal information from copied messages or screenshots.
Ready? What next?#
Your setup is ready when you can run code/copilot_setup_check.py in VS Code, ask Copilot to explain its output and check that explanation against your own calculation. Check which GitHub account is active and locate the mode, model and permissions controls. Can you explain why the script first printed 3 and how you checked your correction? Take the same approach to larger problems: plan → implement → test → explain → rerun.
Next, work through the AI-assisted programming in biology chapter for the concepts and practicals. In a workshop, follow the lecture and use the chapter for the practicals.
To prepare for the chapter’s R practicals, follow the R setup guide.
For coursework, follow the assignment’s rules on AI use and acknowledgement. For research, follow the project’s data and authorship requirements. If you need to acknowledge AI use, record the tool, date, what you asked it to do and how you checked the result.
Optional: Copilot in RStudio#
You can also use GitHub Copilot inside RStudio for your own R work. The MQB lecture, chapter and workshop use VS Code.
RStudio’s integration offers inline code suggestions as you type. Use VS Code for the Chat controls and setup exercise above.
Follow Posit’s Copilot guide for installation requirements and setup. In the current RStudio interface:
Open Tools → Global Options → Assistant and select GitHub Copilot under Use code assistant.
Install the Copilot Agent components when prompted, then click Sign In. Complete the browser verification steps using the GitHub account with Copilot access.
Open an
.Rfile and write a comment describing what you want the code to do. Read any grey suggestion before accepting it with Tab.
For RStudio Server or Posit Workbench, an administrator must enable the integration first.
References#
These are the official guides used for this appendix. They were checked in October 2026; consult the current versions when setting up.
ICL guidance#
ICL ICT: GitHub Copilot — features, supported tools and links to further setup resources.
ICL GitHub documentation: Requesting access — student and staff routes, organisation membership and funding requirements.
General guidance, including for students outside ICL#
GitHub: Apply to GitHub Education as a student — eligibility, evidence and application steps.
GitHub: Access GitHub Copilot for free as a student — activating the benefit after verification and resolving delays.
VS Code: Set up GitHub Copilot — editor setup, sign-in and account switching.
Posit: GitHub Copilot in RStudio — requirements, sign-in and inline code suggestions for the optional RStudio setup.
VS Code: Use the Chat view — finding the session, mode, model and permissions controls.
VS Code: AI language models and approvals and permissions — model selection and action approvals. These controls were checked on 23 October 2026.
GitHub: Plans for Copilot — plan features, model access and usage allowances.
GitHub: Getting started with a GitHub Copilot plan — access options when student or institutional access is unavailable.
GitHub: Asking GitHub Copilot questions in your IDE — chat modes, requests and project context.
GitHub: Troubleshooting common issues with GitHub Copilot — sign-in, extension and service problems.