Phase 2 · Version control
Day 5 · Backing Up to GitHub
Day 5

Backing Up to GitHub

~60 min

Goal — Push your local history to GitHub so it is safe and shareable.

By the end — Your project mirrored on GitHub, with the everyday push loop in hand.

1Create an empty repository online

On GitHub, click the plus button, then New repository. Name it my-first-site and set it to Private or Public as you prefer.

Important

Do not add a README or .gitignore — your project already has files. Then click Create repository.

2Copy the connection address

GitHub shows a setup page with an HTTPS address ending in .git. Copy it; it looks like https://github.com/you/my-first-site.git.

3Connect your local project to GitHub

Back in your terminal, inside my-first-site, run the command below with your address. origin is just the standard nickname for your main cloud copy.

Run in the terminal
git remote add origin https://github.com/you/my-first-site.git

4Name your main branch

Rename your branch so it matches GitHub's default.

Run in the terminal
git branch -M main

5Push your history up

The -u sets this as the default destination, so future pushes are just git push. You may be asked to log in the first time.

Run in the terminal
git push -u origin main

6See it on GitHub

Refresh your repository page. Your files and commit messages are now there.

7Practice the everyday loop

Change a file locally, commit it, then push to send it up. Refresh GitHub to watch it appear.

Run in the terminal
git add . && git commit -m "your message" && git push
Note

Cloning is the reverse direction: git clone <address> downloads any repository — with its full history — onto your machine. It is how a teammate on Windows gets your project and runs it, an idea you will make solid in Phase 4.

Recap — You mirrored your local history to GitHub and learned the commit-then-push loop that keeps your work backed up and shareable.

Day 4Day 6