What you need
- Git installed on your computer, from git-scm.com. Git is what keeps the history of your code; without it nothing can be committed.
- A GitHub account.
- VS Code with GitHub Copilot. The free plan is enough for this.
- A project folder with your code in it.
You do not type a single git command. You write a prompt, Copilot works out the commands, and you approve them. Only two things need real action from you: the token and the empty repository. Everything else is a click or a short answer.
Twelve git words
To prompt Copilot well, you need to know what you are asking for. These twelve words are enough.
| Word | What it means |
|---|---|
| Git | A tool on your computer that tracks changes in your code. |
| GitHub | A website that stores your Git projects online, so others can work with you and see your work. |
| Repository | A project folder that Git keeps track of. |
| Local | The copy on your computer. |
| Remote | A copy stored somewhere else, like GitHub. |
| Origin | The nickname for your remote on GitHub. |
| Main | The default branch: your main line of work. |
| Stage | Pick which changes go into the next save. |
| Commit | A saved snapshot, with a short message. |
| Push | Send your commits from your computer to GitHub. |
| Pull | Bring new commits from GitHub to your computer. |
| Token | A password made for apps like VS Code. |
A commit works like the undo history of a document: you get back whole versions, not single letters. Each commit is stored with a message, a time and an ID.
The prompt formula: action + place + message. For example: "Commit my changes with the message 'add login test' and push to origin main."
Part 1: the first push
The video above walks through this part. You do it once per project.
1. Create a token on GitHub
- Go to Settings › Developer settings › Personal access tokens › Tokens (classic), then Generate new token.
- Give it a name, tick repo, and generate it.
- Copy the token and keep it somewhere safe for the next few minutes. GitHub shows it only once.
2. Create an empty repository
- On GitHub, click + › New repository and give it a name.
- Choose Public if you want others, interviewers included, to see it.
- Leave the README off, so the repository stays empty, and create it.
- Copy the HTTPS URL of the repository.
The repository name and your folder name do not have to match, because Git links them by the URL. Keeping them the same just helps you remember.
3. Open your folder in VS Code
File › Open Folder, then open Copilot Chat and switch the mode to Agent. In Ask mode, Copilot only talks; Agent mode is what lets it run commands.
4. Send Prompt 1
Copy it, replace the capital words with your repository URL and your token, and paste it in Copilot Chat:
This is my GitHub repository URL: https://github.com/YOUR-NAME/YOUR-REPO.git
and this is my token: PASTE_YOUR_TOKEN_HERE.
Check that git is installed, set up this folder as a git repository, create a .gitignore, update the README.md file with a short description of this project,
commit all files with proper message and push the code to that URL on the main branch.
Use the token only for this push. Do not save it in any file or in the git config.
The two lines that matter most are the URL and token, and "commit all files with proper message and push the code to that URL on the main branch". The rest is optional, and your own words work too.
A token typed in chat is like a password. Use a token that expires soon, and delete the chat after your first push.
5. Click Allow
Copilot decides which git commands to run and asks before each one. Click Allow or Continue every time. The first push takes a little longer, because the repository is being set up.
6. Check GitHub
Refresh your repository page. Your files are there, with the first commit and its message.
Part 2: push every day after that
After the first push, the token and the link to GitHub are already set up. From then on, at the end of every class or piece of work, it is one prompt:
Update the main README.md file, commit all changes with a clear message and push the code.
- Keep, then Allow. When Copilot edits a file, such as the README, it asks you to Keep the change. When it wants to run git, it asks you to Allow.
- An edit is not a push. Until the change is committed and pushed, GitHub does not have it.
- No message needed. If you do not give a commit message, Copilot writes a clear one for you.
- The README missed a file? Ask: "Update the repo structure in README.md with all the files."
The wording does not have to match. Anything that says update, commit and push will do.
When Copilot stops and asks you
Copilot cannot do these for you:
| What you see | What to do |
|---|---|
| Copilot asks to run a command | Click Allow or Continue. It cannot run anything without your approval. |
| Copilot only talks and runs nothing | Switch the chat from Ask mode to Agent mode. Ask mode cannot run commands. |
| "git is not recognized", or git is not installed | Install Git from git-scm.com, restart VS Code, then paste the prompt again. |
| It asks for your name and email | Type them. Use the same email as your GitHub account. |
| A sign-in or password box appears | The username is your GitHub username. In the password box, paste the token, not your GitHub password. |
| Authentication failed | The token is wrong, expired, or missing repo. Create a new token and try again. |
| Push rejected | The GitHub repository was not empty. Ask Copilot: pull from origin main, then push. |
Common questions
- Must the folder name and the GitHub repo name match?No. Git links them with the repository URL. The same name just helps you remember.
- Must my Git name match my GitHub username?No. For your commits to show on your GitHub profile, use an email that is added to your GitHub account.
- Public or private repository?Public is fine for practice, and lets you show your work on your resume. Choose private for anything you want to keep to yourself.
- I see "master", but GitHub says "main".Ask Copilot: rename my branch to main and push it to origin.
- Do I push every time I save a file?No. Commit when a piece of work is done, then push to back it up. At the end of each class is a good habit.
- I pasted my token in my code.Delete that token on GitHub right away, and create a new one.
You give the command. Copilot does the git work. Knowing the words is the real skill.
Reference links
- Part 1: creating the folder and token, and the first pushloom.com/share/11ac5c3a9ca04473b0825f90445efdd6
- Part 2: pushing every day after the first timeloom.com/share/5fbf45f0965847a7b2fe72c0345596de
- Install Gitgit-scm.com
- Your GitHub tokensgithub.com/settings/tokens
- Create a new repositorygithub.com/new
- GitHub Copilot in VS Codecode.visualstudio.com/docs/copilot/overview