Create a GitHub Repo
If Git is your personal time machine, then GitHub is your cloud museum. It's where you back up your hard work, show it off to the world, or invite teammates to collaborate (and occasionally break things together).
Now, I’ll be honest—I used to avoid GitHub when I was just getting started. “I’ll upload it later,” I’d say. Famous last words. One laptop crash later, and poof—my side project vanished like Thanos snapped it. Since then, I’ve lived by this golden rule: push early, push often.
In this lesson, you’ll learn how to create a GitHub repository (a.k.a. "repo"), link it to your local project, and push your code online like a boss.
What Exactly Is a GitHub Repository? (And Why You Should Care)
Think of a GitHub repo as a magical folder in the cloud. It holds your project’s files, commit history, and everything you’ve done with Git locally—except now it’s available anywhere you log in.
Even better? You can:
- Collaborate with others (like tagging a friend to help debug your spaghetti code)
- Track progress visually (commits, branches, pull requests)
- Showcase your portfolio (employers will check your GitHub, trust me)
Bonus: it’s free. You get unlimited public repos, and even private ones now. No excuse not to use it.
Step-by-Step: Creating Your First GitHub Repo (No Panic Required)
Here’s how you spin up a shiny new repo on GitHub:
- 1Go to github.com and sign in.
- 2Click the little + icon in the top-right → hit New repository.
- 3Give it a name, like
my-js-project
. (Try to be descriptive, not just “project1” 🙃) - 4Decide if it should be public (visible to all) or private (just for you and your invited collaborators).
- 5Don’t check any boxes for README or
.gitignore
yet—we’ll add those manually. - 6Click Create repository.
Boom. You now have a blank canvas in the cloud, ready to be linked to your local masterpiece.
Linking Your Local Project to GitHub (Git Says Hello to the Cloud)
So you’ve been working locally, and your project’s already initialized with Git. Now you want to send it to the GitHub repo you just created.
Copy your repo URL (it’ll look like https://github.com/your-username/my-js-project.git
) and run this in your project folder:
git remote add origin https://github.com/your-username/my-js-project.git
That command tells Git, “Hey, when I push code, send it to this place.”
Wanna double-check it worked? Run:
git remote -v
You’ll see origin
listed. If not, something’s off—Google the error message or, better yet, read Git’s official docs when you're stuck.
Push Your Code to GitHub (Moment of Glory)
Ready to send your work into cyberspace?
On your first push, do this:
git push -u origin main
(If your branch is called master
, use that instead of main
. GitHub switched to main
as the default for new repos.)
After that first time, just run:
git push
Now refresh your repo page on GitHub. See it? That’s your code, online. Immortalized. And hopefully bug-free.
Note: If Git yells at you about authentication, you might need to set up a personal access token instead of a password. GitHub made this change recently for security reasons.
My First Time Pushing to GitHub (Yes, I Messed It Up)
My first push? Total disaster. I forgot to initialize Git in my local folder, linked it to GitHub anyway, and couldn’t figure out why it wasn’t working. I ended up nuking the repo and starting over.
Moral of the story: Git and GitHub are incredibly powerful, but you will hit a few walls at first. Don’t worry. It’s all part of learning. And once it clicks, it changes how you write and share code forever.
What’s Next? Push, Pull, and Clone Like a GitHub Ninja
Now that your code’s on GitHub, it’s time to learn how to keep it in sync between machines, share it with others, and download other people’s projects.
In the next lesson, we’ll cover how to Push, Pull, and Clone — the real bread and butter of working with GitHub every day.
Welcome to the cloud, dev!