Part 2 of 5 · Beginner's Handbook
GitHub Essentials
This part is about the actual GitHub website and how your local Git repo talks to it — creating repos, pushing a real project folder for the first time, and grabbing other people's code. If you haven't installed Git yet, do Part 1 — Git Basics first.
Jumping in here? This chapter assumes you already know what a repo, commit, and branch are, and that Git is installed on your machine. If any of that sounds unfamiliar, Part 1 — Git Basics covers it in five minutes.
01 HTTPS vs SSH — Two Ways to Connect
Before pushing anything, GitHub needs to know it's really you. There are two common ways to authenticate from your terminal — both just log you in, they don't change what Git itself does:
-
HTTPS — the same
https://you already know from web addresses. GitHub will ask you to sign in through the browser the first time, or use a Personal Access Token (a special auto-generated password meant just for this, which you can revoke any time) instead of your real password. Good default if you're just starting out. - SSH (Secure Shell) — uses a "key pair" stored on your computer instead of a password: one half stays secret on your machine, the other half you give to GitHub, and the two prove to each other that it's really you. Slightly more setup, but you never type a password again to push or pull — especially nice on Linux or if you push often.
To set up SSH, generate a key and add the public half to GitHub:
Copy the printed key, then on GitHub go to Settings → SSH and GPG keys → New SSH key and paste it in. Test the connection:
From then on, use git@github.com:username/repo.git style URLs instead of
https://github.com/... when cloning or adding a remote.
02 Creating a New Repo on GitHub (Web)
This is the most common starting point for a brand-new project:
- Log in to GitHub and click the + icon top-right → New repository.
- Give it a short, clear name — no spaces, hyphens are fine (
weather-app). - Choose Public or Private (you can change this later, see below).
- If this is a brand-new project with nothing local yet, tick Add a README file so the repo isn't completely empty. A README is just a text file (written in a simple format called Markdown — more on that in Part 4) that GitHub displays front-and-center on the repo's page. If you already have a project folder on your computer, leave everything unticked — you'll connect it yourself in the next section.
- Click Create repository. GitHub shows you the repo's URL — keep that tab open.
03 Pushing a Whole Project Folder for the First Time
The most common beginner question: "I have a folder full of code on my computer — how do I get all of it onto GitHub?" Here's the full path, assuming you created an empty repo on GitHub (no README, no .gitignore):
-
Open a terminal inside your project folder (the one with all your files):
$cd path/to/your-project
-
Turn it into a Git repo (skip this if it already has a hidden
.gitfolder):$git init -b main -
Stage and commit everything in the folder:
$git add .$git commit -m "initial commit"
-
Point your local repo at the empty GitHub repo you created (copy the URL from GitHub's
"Quick setup" page — HTTPS or SSH, matching whichever you set up above):
$git remote add origin git@github.com:username/your-project.git
-
Push every file to GitHub:
$git push -u origin main
Refresh the GitHub page — your entire folder structure, subfolders included, should now be there.
This happens if you ticked "Add a README" when creating the repo. Run
git pull origin main --allow-unrelated-histories, resolve any conflict, then
push again.
04 Creating a Repo from the Terminal (GitHub CLI)
CLI stands for Command-Line Interface — just a technical way of saying "a tool
you control by typing commands," as opposed to clicking around a website. The
GitHub CLI is a separate program (its command is gh, distinct from the
git command you've been using) that lets you do most GitHub-website tasks —
creating repos, opening pull requests, and more — without ever leaving your terminal. It's
optional: everything it does can also be done by clicking around the GitHub website, this is
just a faster path once you're comfortable in a terminal. Install it first:
Log in once (it walks you through browser authentication):
Now you can create a repo and push your current folder to it in one go, without ever opening a browser:
Swap --public for --private if you don't want it visible to
everyone. That one command creates the repo on GitHub, links it as origin, and
pushes your first commit — the web UI steps above, compressed into one line.
05 Cloning vs Forking Someone Else's Project
Two different things beginners often mix up:
-
Clone — download a copy of any repo you can already see (including your own)
to work on locally. You get the code, but if you don't have write access to the original,
you can't push changes back to it.
$git clone https://github.com/someone/their-repo.git
- Fork — make your own copy of someone else's repo under your own GitHub account. You get full write access to your fork, so you can make changes, commit, and push freely, then later propose those changes back to the original via a pull request (covered in Part 3).
Click Fork on the repo's GitHub page to create your copy, then clone your fork (not the original) to work on it locally:
06 Public vs Private (and Changing Later)
- Public — anyone can see the code (great for portfolios, open source).
- Private — only you and people you explicitly invite can see it.
You're not locked into your choice. To switch later: open the repo on GitHub → Settings → scroll to the Danger Zone at the bottom → Change visibility. The same Danger Zone is also where you rename, transfer ownership of, or permanently delete a repo — GitHub makes you type the repo name to confirm deletion, so it's hard to do by accident.
Heads up: if a repo was ever public, assume anything pushed to it — including old commits — may have been seen or cached somewhere. Making it private afterward hides it going forward, but doesn't retroactively erase copies others may have made.
07 Prefer a GUI? GitHub Desktop
This handbook is terminal-first because typing commands makes the underlying model click faster, but you don't have to live in the terminal forever. A GUI (Graphical User Interface — the technical term for a point-and-click app) can do the same job. GitHub Desktop (from desktop.github.com) gives you that same add / commit / push / pull / branch workflow, just with buttons instead of commands — useful for reviewing changes visually or for teammates who aren't comfortable with a terminal yet. Most editors (VS Code, JetBrains IDEs) also have built-in Git panels that cover the everyday cycle without needing a separate app at all.
08 Common Errors & Fixes
GitHub no longer accepts your account password over HTTPS. Generate a Personal Access Token (Settings → Developer settings → Personal access tokens) and use that as your password, or switch to SSH.
The folder is already linked to a remote. Either remove it with
git remote remove origin and add the correct one, or update it directly with
git remote set-url origin <URL>.
Your SSH key isn't set up or isn't added to GitHub. Re-check the steps
in HTTPS vs SSH above, and confirm with
ssh -T git@github.com.
09 GitHub Essentials Cheat Sheet
| gh auth login | Log the GitHub CLI into your account |
| gh repo create name --public --source=. --push | Create a repo on GitHub and push the current folder to it, in one step |
| gh repo clone user/repo | Clone a repo using the CLI instead of a full git URL |
| gh repo view --web | Open the current repo's GitHub page in your browser |
| git remote add origin <URL> | Link a local folder to a GitHub repo for the first time |
| git remote -v | Show which GitHub URL(s) this folder is connected to |
| git remote set-url origin <URL> | Change the GitHub URL if you already have one set |
| git clone <URL> | Download a full copy of any repo you can see |
Ready to work with other people? Head to Part 3 — Working with Others to add collaborators, open pull requests, and resolve merge conflicts.