In simple words
- GitHub: a website that hosts Git repositories and adds pull requests, issues, Actions and security tools.
- Repository: a project's files and history.
- Fork: your own copy of someone else's repository, so you can propose changes.
- README / LICENSE: the front-page description of a repo, and the rules for using its code.
Big picture
Git is a tool on your computer that remembers every version of your files. GitHub is a website that stores your Git projects online, so a team can share them. Think of Git as a notebook and GitHub as the shared shelf where everyone leaves their notebooks.
The main ideas
| Word | Plain meaning |
|---|---|
| Repository (repo) | A project folder with all its history, stored on GitHub |
| Clone | Copy a repo from GitHub to your computer |
| Fork | Make your own copy of someone else's repo on GitHub |
| README | The front page of the repo. It says what the project is |
| Organization | A shared account for a company or team that owns repos |
| Visibility | Public (everyone sees it) or private (only people you allow) |
Create your first repo
gh repo create acme/app --private --clonecd appecho "# App" > README.mdgit add README.mdgit commit -m "Add README"git push -u origin main✓ Created repository acme/app on GitHub✓ Cloned repository acme/app[main (root-commit) 3f2a1b9] Add README 1 file changed, 1 insertion(+)Branch 'main' set up to track 'origin/main'.gh is GitHub's command line tool. You can also click New repository on the website.
Sign in safely with SSH keys
An SSH key is a pair of files: a private key that stays on your laptop, and a public key that you give to GitHub. GitHub uses the pair to know it is really you, with no password.
ssh-keygen -t ed25519 -C "you@example.com"cat ~/.ssh/id_ed25519.pubssh -T git@github.comHi leela! You've successfully authenticated, but GitHub does not provide shell access.Paste the .pub file into Settings → SSH and GPG keys. Never share the file without .pub.
Fork and clone
Use a fork when you cannot write to a project, such as an open source one. Use clone when you can.
gh repo fork cli/cli --cloneFiles every repo should have
| File | Why |
|---|---|
README.md | What it is and how to run it |
.gitignore | Files Git must skip, like node_modules and secrets |
LICENSE | What others may do with your code |
CONTRIBUTING.md | How to help |
Git in one minute
GitHub works with Git. These are the Git commands you will use every day:
| Command | What it does |
|---|---|
git status | Shows which files changed |
git add FILE | Puts a change in the next save (a "commit") |
git commit -m "message" | Saves the change with a short note |
git push | Sends your commits to GitHub |
git pull | Gets new commits from GitHub |
git log --oneline | Shows the history |
git log --oneline3f2a1b9 Add READMEa91c0de Initial commitEach line is one saved version. The short code on the left is the commit's id.
Check that you are logged in
gh auth logingh auth statusgit config --global user.name "Leela"git config --global user.email "you@example.com"github.com ✓ Logged in to github.com account leela (keyring) - Active account: trueGit adds your name and email to every commit, so set them once.
Public or private?
| Choice | Who sees the code | Good for |
|---|---|---|
| Public | Everyone | Open source, learning, portfolios |
| Private | Only people you invite | Company code, anything with secrets |
| Internal (companies) | Everyone in the company | Shared company tools |
Common mistakes
- Committing passwords or
.envfiles. Add them to.gitignorefirst. - Working directly on
main. Use a branch (next lessons). - Sharing the private key instead of the public one.
Summary
- GitHub stores Git repos online so teams can share them.
- Clone to copy, fork to get your own copy of someone else's project.
- SSH keys let you sign in without a password.
- Start every repo with a README,
.gitignoreand a license.
CHECK YOUR UNDERSTANDING
3 quick questions
1. What is the difference between a clone and a fork?
2. Which key do you paste into GitHub for SSH sign-in?
3. What should go in .gitignore?