# Put Your Code on GitHub

Hand in an exercise as a link, with no Git needed, by making a free GitHub account and a public repository and uploading your files in the browser, everything but node_modules.

Novice · Web Development · JavaScript · Updated November 13, 2026

## After this lesson you can

- Put a project's files in a public GitHub repository by uploading them in the browser, and hand in its address
- Choose which of a project's files to upload, leaving out node_modules, and explain why it stays behind

## Key takeaways

- GitHub keeps project files online. Each project is a repository (repo), and anyone with a public repo's address can open it and read its code.
- You can make a repository and upload files in the browser, with New repository, then Add file and Upload files. No Git or other software is needed.
- A commit is a saved snapshot of your files with a short note saying what changed. Upload again and commit, and the repo keeps both versions.
- Leave node_modules out when a project has one. It holds packages npm install downloaded, not your code, and npm install makes it again from package.json.
- To hand in an exercise, paste your public repo's address, such as https://github.com/your-username/exercise-javascript-daily-specials, into Submit your exercise.

Your `daily-grind` folder already holds two programs and a web page, and the next lesson is your first exercise. When its tests pass, someone else needs to see your code: this course, to mark the exercise complete; a teacher who says "submit a link to your repo"; someone hiring, who wants to see what you can build. Your laptop can't be the answer, because nobody else can open it. This lesson sets up the free account you'll hand in every exercise with, and walks through handing one in, screen by screen. There's nothing to install: it all happens in your browser.

**What it costs: nothing.** A GitHub account and public repositories are free. Nothing in this lesson asks for a payment card.

## Why not email it?

The first thing most people try is attaching the files to an email or a message. It falls apart quickly:

- **It's blocked.** Many email services refuse `.js` files outright: a JavaScript file is a program, and some viruses travel that way, so the attachment never arrives.
- **Every change means sending it again,** and soon nobody knows which copy is the latest.
- **Nothing can open it.** A file in someone's inbox has no address that a website, or a teacher's browser, can visit.

A shared cloud-drive folder gets the files there, but they're private until you change its settings, and it keeps no clear record of what changed and when. What you want is a public shelf for code: one with an address anyone can open, that keeps every version. That's what GitHub is.

## GitHub and repositories

**GitHub** is a website where people keep their projects' code online, from homework to the code behind famous apps. Each project gets its own **repository** (people say *repo*): a folder of files on GitHub that also remembers every earlier version of them. Think of a binder on a library shelf: one binder per project, a label on the spine, and every page you've added kept in order.

A **public** repository is one anyone can open, without an account. That's what you want here: the course, your teacher or a friend follows the link and reads your code. Its address is GitHub's, then your username, then the repo's name:

```text
https://github.com/your-username/daily-grind
```

## Step 1: a free account

1. Go to `github.com` and choose **Sign up**.
2. Enter your email address, a password and a **username**. GitHub emails you a code, to check the address is yours.
3. If GitHub asks you to turn on **two-factor authentication** (a second check, such as a code from an app on your phone, when you sign in somewhere new), follow its steps. It keeps your account safe.

Pick the username with care. It's public and it's part of every repo's address, so choose one you'd be happy to put on a resume. It doesn't have to be your full name.

## Step 2: a repository for your code

1. Signed in, choose the **+** in the top-right corner, then **New repository**.
2. Type a name in lowercase with hyphens, such as `daily-grind`. For an exercise, the exercise's own name works well, such as `exercise-javascript-daily-specials`.
3. Choose **Public**.
4. Turn **Add README** on (some screens call it *Add a README file*). A README is a page of notes about the project. It gives the new repository its first file, so the upload button appears.
5. Choose **Create repository**.

![GitHub's new-repository form with the name daily-grind, Public chosen and Add README turned on, above the Create repository button](https://www.ask-codey.com/lessons/TODO)

## Step 3: upload your files

1. On your new repository's page, choose **Add file**, then **Upload files**.
2. On your computer, open your project folder and select **everything inside it** (**Ctrl+A** on Windows, **Cmd+A** on a Mac): for `daily-grind`, that's `hello.js`, `chalkboard.js`, `index.html` and `app.js`.
3. Drag the selection onto the upload area. Drag what's inside the folder, not the folder itself, so your files land at the top of your repo and not one folder down.
4. Wait until every file is listed. Under **Commit changes**, type a short note about what you're adding, such as *The Daily Grind's first programs*, and choose **Commit changes**.

A **commit** is a saved snapshot of the files, with a note saying what changed. Your repo's page now lists your files, with the commit's note beside them. Click `app.js` and GitHub shows its code, with line numbers, the way VS Code does. Every exercise folder has its own `README.md`, and when you upload it, it replaces the one GitHub made.

![GitHub's Upload files page listing hello.js, chalkboard.js, index.html and app.js from the daily-grind folder, a commit note typed in and the Commit changes button below](https://www.ask-codey.com/lessons/TODO)

## One folder that stays behind: node_modules

The exercises in Modules 1 to 5 need nothing but Node.js, so everything in their folders goes up. In Module 6, projects use ready-made tools from **npm** (*npm and Packages* explains them), and `npm install` downloads those tools into a folder named `node_modules` (read "node modules"). For the Module 6 projects, that's thousands of files.

When a project has a `node_modules` folder, leave it out: after **Ctrl+A** (**Cmd+A**), **Ctrl+click** it (**Cmd+click** on a Mac) to take it out of the selection. None of it is your code. It's the same tools anyone gets by running `npm install` in the folder, because `package.json` lists exactly which ones to fetch. Uploading it wouldn't work anyway: GitHub's upload takes at most 100 files at a time. So `node_modules` stays on your computer, and `package.json` goes up, so anyone can make the folder again with `npm install`.

Here's a Module 6 exercise's folder, and what goes up:

```text
exercise-javascript-bookstore-search-main/
├── .gitignore          upload
├── README.md           upload
├── index.html          upload
├── node_modules/       leave out
├── package-lock.json   upload
├── package.json        upload
├── src/                upload: your code
├── styles.css          upload
└── vite.config.js      upload
```

The `.gitignore` file in each exercise is a note for **Git**, a program many developers use to send their code to GitHub from the terminal. It lists `node_modules`, so Git leaves the folder out by itself. Uploading in the browser doesn't read that note, which is why you leave `node_modules` out yourself. (On a Mac, Finder hides files whose names start with a dot, so `.gitignore` stays behind. That's fine: the exercise doesn't need it.)

## Hand in an exercise

Every exercise lesson ends with **Submit your exercise**. When your work is done:

1. Make a public repository for it (Step 2), and upload everything in the exercise's folder, except `node_modules` if it has one (Step 3).
2. Copy the repo's address from your browser's address bar, such as `https://github.com/your-username/exercise-javascript-daily-specials`.
3. Paste it into **Submit your exercise** on the lesson page.

The site checks that the repo is public and holds your own commits, and then the lesson is complete. Changed something afterwards? Upload the changed files again (a file with the same name replaces the old one), commit, and submit again: your latest submission is the one that counts.

## What public means

Anyone can open a public repository and read every file in it, earlier versions included. So before you upload, leave out anything private: your home address, your phone number, passwords, and photos of people who haven't said yes. An exercise's files have none of that, and that's how it should stay.

## A live address for your page

Your `daily-grind` repo holds a web page, and GitHub can show it as a website, for free, with **GitHub Pages**:

1. In the repository, choose **Settings**, then **Pages** in the list on the left.
2. Under **Build and deployment**, set **Source** to **Deploy from a branch**.
3. Under **Branch**, choose **main** and **/ (root)**, then **Save**.

Wait a minute or two, and refresh: the Pages screen shows your page's address, `https://your-username.github.io/daily-grind/`, with a **Visit site** button. Open it, then the Console (**F12**): the two lines from `app.js` are there, on a page anyone can visit. *Put Your App Online with GitHub Pages*, in Module 6, does the same for a whole app.

**Try it.** Make your GitHub account now, then a public repository named `daily-grind`. Upload the four files from your `daily-grind` folder, commit them, and open the repo's address in a private window (**Ctrl+Shift+N** in Chrome and Edge, **Cmd+Shift+N** on a Mac): that's what anyone else sees. You'll do it for real at the end of *Exercise: The Daily Specials*.

## Check yourself

2 questions to try on the lesson page.

## So what

A link to a repo is how developers share their code, with a class, a team or someone hiring. From here on, every exercise you finish is one upload away from being handed in.

## Key terms

- GitHub
- Repository
- Commit
- node_modules

## Related

- [JavaScript on a Web Page](https://www.ask-codey.com/lessons/javascript-first-programs-on-a-web-page)
- [Exercise: The Daily Specials](https://www.ask-codey.com/lessons/exercise-javascript-daily-specials)
- [Put Your App Online with GitHub Pages](https://www.ask-codey.com/lessons/javascript-shipping-github-pages)

Source: https://www.ask-codey.com/lessons/javascript-put-your-code-on-github
