How to install GitHub Copilot CLI and build a first page

Day 1, 30 minutes · beginner

Goal of this lessonInstall Copilot CLI, sign in and let Copilot plan and build a small practice website in a new git repository.

Why it matters

Many people use GitHub Copilot only for the grey suggestions that appear while they type. That is the smallest part of it. Copilot can also work as a coding agent: you describe a job in plain words, and Copilot reads your files, makes a plan, edits files and runs commands to check its work. It does this in your terminal with Copilot CLI, and on GitHub itself, where you can hand it an issue and get a pull request back.

You will follow one small project through the whole course. Roos runs Brindlewick Cheese, a made-up cheese shop, and wants a simple website with a cheese list that is always right. Over six lessons you hand that work to Copilot in bigger pieces: first one task in your terminal, later an issue on GitHub that Copilot works on while you do something else.

Today you install Copilot CLI, sign in, let Copilot plan before it builds, and end with a working one-page site in a git repository that you committed yourself.

What you need

  • A terminal and git. You should be able to open a terminal, go into a folder and paste a command. Run git --version to check that git is installed.
  • A GitHub account with a Copilot plan. GitHub's plans page says every Copilot plan includes Copilot CLI, including Copilot Free. If you have no plan yet, you can start Copilot Free from that page. Free uses automatic model selection only and has a monthly allowance of GitHub AI Credits; Copilot CLI uses those credits every time it works.
  • For lessons 4 and 5 only: Copilot in the cloud (the cloud agent) and Copilot code review on pull requests are not in Copilot Free. They are in Copilot Student, Pro, Pro+, Max, Business and Enterprise. Lessons 1, 2, 3 and 6 work on Free, and lessons 4 and 5 show what to do without the cloud agent.
  • At work: with Copilot Business or Enterprise, your organization's policies decide what you may use. An owner or administrator can switch Copilot CLI or the cloud agent off.

This course is about GitHub Copilot, the coding assistant from GitHub. It is not Microsoft Copilot, the assistant in Microsoft 365 and Windows, which has its own courses on this site.

A few words you will meet

  • Repository (repo): a folder that git tracks, so every change can be seen and undone.
  • Trusted folder: a folder where you allow Copilot to read, change and run files. Copilot asks the first time you start it in a folder.
  • Plan mode: a mode in which Copilot asks questions and writes a plan before it writes any code.
  • Tool approval: when Copilot wants to run a command or change a file, it can ask you first. You answer yes or no.
  • Slash command: a line that starts with /, such as /login. It is a command for Copilot CLI itself, not a message to the model.

The steps

  1. Install Copilot CLI with the command for your system. The guide below has the exact lines.
  2. Check the install in a new terminal window with copilot --version.
  3. Make a git repository called brindlewick-cheese, so every change Copilot makes can be seen and undone.
  4. Start Copilot and trust the folder. Start it inside the project folder, never in your home folder. Choose to remember the folder: lesson 6 needs a trusted folder for its hook.
  5. Sign in with /login. Copilot remembers your login, so you do this once. Copilot may also suggest running /init because the project has no instructions file yet. Leave that for lesson 2.
  6. Plan first. Switch to plan mode and give the task with a goal, the details, limits and a clear "done when". Read the plan and answer Copilot's questions before any code is written.
  7. Build and approve. Leave plan mode and let Copilot build. Shift+Tab cycles through more than one mode: stop at the normal mode, not at autopilot, which works without asking you. Read each command before you approve it.
  8. Review and save. Check the new files and the page yourself, then commit.

Follow the guide for GitHub Copilot below for the exact commands.

How approvals work

When Copilot wants to run a command or change a file, it can stop and ask. Yes allows this one request. A second option allows that tool without asking again; the wording depends on the request and says how long it lasts. No, and tell Copilot what to do differently (Esc) cancels it, and you can type what you want instead. Be careful with the second option: GitHub's own example is that approving rm once can let Copilot run any rm command later, including one that deletes a whole folder.

Why you commit, not Copilot

Copilot can commit and even open pull requests for you. In this course you do it yourself in the first lessons, so you see every change before it lands in git. The task even says "Do not commit". If git complains that it does not know your name and email, it prints the two commands to set them: run those once and commit again.

Example: Roos's first task

Roos switched to plan mode and pasted the task. Copilot asked one question: should the table show the milk type? She said yes. The plan listed two files and a check that the prices match. After she left plan mode, Copilot asked to create cheeses.json and index.html; she read both requests and chose Yes. git status showed two new files, the Hazel Blue said 3.90 in the browser, and she committed with the message "First version of the site".

Common mistakes on day 1

  • Starting Copilot in your home folder. Copilot works in the folder where you start it. Always cd into the project first.
  • Approving without reading. The approval prompt shows the exact command. Read it every time on day 1.
  • Skipping plan mode. For a small page it feels slow. For anything bigger it is where you catch a misunderstanding before it costs credits and time.
  • Pasting the Windows line into a Mac terminal. Each system has its own install line.

Deeper dive

Today's actions

Ticks are not saved without an account

Do it in GitHub Copilot

GitHub Copilot

  1. On Windows, open PowerShell, paste this line and press Enter. On macOS or Linux, use the Homebrew or install script line from the notes instead.
    winget install GitHub.Copilot
  2. Open a new terminal window and run copilot --version. A version number means the install worked.
  3. Make the practice folder and turn it into a git repository. Run one line at a time.
    mkdir brindlewick-cheese
    cd brindlewick-cheese
    git init
  4. Run copilot. When Copilot asks whether you trust the files in this folder, choose Yes, and remember this folder for future sessions: you just made it, and later lessons need it trusted.
  5. If Copilot asks you to log in, type /login, choose GitHub.com, then Sign in with your browser (recommended), and finish the sign-in in the browser window that opens.
  6. Press Shift+Tab to switch to plan mode. Paste this task and press Enter. Answer Copilot's questions and read the plan before anything is built.
    Build a one-page website for Brindlewick Cheese, a small cheese shop run by Roos. Create index.html with the shop name, a short welcome, the opening hours (Wednesday to Saturday, 9:00 to 17:30) and a table of cheeses. Create cheeses.json with three cheeses and their price in euros per 100 g: Old Brindle (aged cow's milk, 3.20), Hazel Blue (blue cheese, 3.90), Smoked Fennel (smoked goat's milk, 3.60). The table in index.html must match cheeses.json. Plain HTML and CSS only, no build tools, no other files. Do not commit. Done when both files exist and you have listed what you made.
  7. Press Shift+Tab until you are back in the normal mode. If you land in autopilot or Copilot asks for full permissions, press Shift+Tab again and grant nothing. Then type Build it as planned. and choose Yes or No, and tell Copilot what to do differently (Esc) for each request.
  8. Type /exit. Run git status to see the new files, open index.html in your browser and check the prices. Then commit with git add -A and git commit -m "First version of the site".

Note: Other installs from the same page: brew install --cask copilot-cli (macOS and Linux), curl -fsSL https://gh.io/copilot-install | bash (macOS and Linux) or npm install -g @github/copilot (needs Node.js 22 or later). On a remote machine, /login offers Sign in with a device code instead. copilot update installs the latest version.

Checked on 4 December 2026 · Source: GitHub Docs: Installing GitHub Copilot CLI (opens in a new tab)

Create a free account to save your progress. Sign in or sign up