# Hand In Your Work with Git

Hand in an exercise by making a public repository of your own on GitHub, pointing your clone at it with git remote set-url, saving your work with git add and git commit, sending it with git push, and submitting the repository's address.

Novice · Git · Updated November 19, 2026

By Gregor Dzierzon

## After this lesson you can

- Save your work in a commit with git add and git commit, checking each step with git status
- Send your work to a public repository of your own with git remote set-url origin and git push -u origin main

## Key takeaways

- You can't push to the exercise's own repository, so you make a public, empty repository of your own on GitHub and point your clone's origin at it with git remote set-url.
- git add stages your changes, and git commit saves them as one snapshot with a message. git status shows each step.
- git push -u origin main sends your commits to GitHub. The first time, Git Credential Manager signs you in through your browser.
- Submitting your repository's address on the exercise lesson is what completes it. Push again and resubmit after any change.

You've finished an exercise, and every test passes, but the work is on your computer, where nobody else can see it. The site checks exercises on GitHub, so the work has to get there, into a repository of your own. And you can't send it back where it came from: the exercise's repository belongs to ask-codey, and Git refuses a push from anyone who doesn't own it. So you make a repository of your own, point your copy at it, and send your work there. It takes five steps, and the same five finish every exercise.

The examples use an exercise named `exercise-first-steps`, whose work is in `first-steps.js`; your exercise's names will be its own (in a Python course, a `.py` file). Run every command in VS Code's terminal, inside the exercise's folder.

## Make a public repository of your own

On GitHub, click the **+** at the top right, then **New repository**:

1. **Repository name:** the exercise's name, such as `exercise-first-steps`.
2. **Public**, so the site, and anyone you show, can see it.
3. Leave **Add README** off: your folder already has one, and a new README on GitHub would clash with it.
4. Click **Create repository**.

![GitHub's Create a new repository form with the name exercise-first-steps, Public chosen and Add README left off, above the Create repository button](https://www.ask-codey.com/lessons/TODO)

GitHub shows the new, empty repository's address, such as `https://github.com/your-name/exercise-first-steps.git`, with your username in place of `your-name`.

## Point your copy at your repository

A clone's **origin** is the address it came from. Change it to your new repository's address with `git remote set-url`, then check it with `git remote -v`:

```bash
git remote set-url origin https://github.com/your-name/exercise-first-steps.git
git remote -v
```

```text
origin	https://github.com/your-name/exercise-first-steps.git (fetch)
origin	https://github.com/your-name/exercise-first-steps.git (push)
```

![git remote set-url moves your clone's origin from the exercise's repository on GitHub to your own, so git push sends your commits to your repository](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/635786796e7e449f83d8ea3c8c991421.webp)

## Save your work in a commit

Packing a parcel takes two steps: you choose what goes in the box, then you seal it and write the label. Git works the same way. `git add` chooses what goes in, called **staging**, and `git commit` seals it into a **commit**, a snapshot with a message. `git status` shows what's in each step. Before you add anything:

```bash
git status
```

```text
On branch main
Your branch is up to date with 'origin/main'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   first-steps.js

no changes added to commit (use "git add" and/or "git commit -a")
```

`git add .` stages every change in this folder (the `.`, read "dot", means "this folder"). Run `git status` again, and the file moves under **Changes to be committed**. On Windows, `git add` may also print a warning that `LF will be replaced by CRLF`: that's about how lines end in a text file, and you can ignore it. Then commit, with a message that says what you did:

```bash
git add .
git commit -m "My solution"
```

```text
[main fbd1aef] My solution
 1 file changed, 1 insertion(+), 1 deletion(-)
```

Your commit gets its own id in place of `fbd1aef`. `git status` now says `Your branch is ahead of 'origin/main' by 1 commit`: the commit is saved on your computer, and GitHub doesn't have it yet.

## Send it with git push

```bash
git push -u origin main
```

`git push` sends your commits to origin, your repository. `-u` links your `main` branch to GitHub's, once, so later pushes need only `git push`. Git prints a few lines as it sends, ending with `branch 'main' set up to track 'origin/main'.` Refresh your repository's page on GitHub, and your files are there.

The first time you push, **Git Credential Manager** opens a window to sign you in to GitHub. Choose **Sign in with your browser**, then **Authorize** on the GitHub page that opens. Git remembers you after that.

## Submit, and fix what goes wrong

Paste your repository's address, such as `https://github.com/your-name/exercise-first-steps`, into **Submit your exercise** on the exercise lesson. The site checks that the repository is public and holds your commits, and the lesson is complete. Changed something later? Commit, `git push`, and submit again: your latest submission is the one that counts.

| What you see | What to do |
|---|---|
| `nothing to commit, working tree clean` when you expected changes | Your files aren't saved. Save them in VS Code, then `git add .` and commit again. |
| `Author identity unknown` | Git doesn't know your name yet. Run `git config --global user.name "Your Name"` and `git config --global user.email "you@example.com"` with your own, then commit again. |
| `Permission to ask-codey/... denied` or `403` | origin still points at the exercise's repository. Run the `git remote set-url` line with your own address. |
| `Username for 'https://github.com':`, or `Support for password authentication was removed` | Git Credential Manager isn't set up, so Git asked for a password, which GitHub doesn't take. Install it as your course's Git setup lesson shows, then push again. |
| `! [rejected] main -> main (fetch first)` | Your GitHub repository has a commit you don't, usually a README made with it. Make a new repository with **Add README** off, point origin at it, and push. |

## Check yourself

2 questions to try on the lesson page.

## So what

Make a repository, point origin at it, add, commit and push: those five steps hand in every exercise, and they're the same steps a developer at work uses to share code every day.

## Key terms

- [git add](https://www.ask-codey.com/glossary/git-add)
- [git commit](https://www.ask-codey.com/glossary/git-commit)
- [git push](https://www.ask-codey.com/glossary/git-push)
- [Commit](https://www.ask-codey.com/glossary/commit-git)
- [git remote](https://www.ask-codey.com/glossary/git-remote)
- [Remote URL](https://www.ask-codey.com/glossary/remote-url)

Source: https://www.ask-codey.com/lessons/git-hand-in-your-work
