Create your first GitHub repository (with README, .gitignore & license)
Your journey into GitHub starts with one button: "New repository". This guide walks you through every choice — README, .gitignore, license — and shows how to clone it to your computer.
Your computer (local) ↔ GitHub (remote)
Go to github.com and sign in. In the top‑right corner, click the plus icon and select "New repository" (or use the green "New" button on your repositories page).
Repository name
Choose a short, descriptive name (e.g., my-first-project). Use hyphens instead of spaces.
Description (optional)
Explain what your project is about. It helps others understand your repo at a glance.
✅ Public or Private? Public = anyone can see it (great for open source). Private = only you and invited collaborators.
This is where most beginners get confused – but it's super useful. You can check these boxes to auto‑generate essential files.
README.md
A README is the front page of your repository. It usually contains: project title, description, how to install/use, and examples. GitHub shows it directly on your repo home page. Always a good idea to add it!
# My First Project
This is my first GitHub repo. I'm learning how to use Git and GitHub.
## Installation
`npm install my-project`
.gitignore
A .gitignore file tells Git which files not to track (e.g., temporary files, node_modules, API keys, IDE settings). GitHub offers templates for different languages (Python, Node, Java, etc.).
.gitignore with common patterns for that language.License
A license tells others what they can and cannot do with your code. For public repos, it's essential. Common choices:
- MIT – very permissive, allows anyone to do anything as long as they include the original copyright.
- GPL – requires derivative works to also be open source.
- Apache 2.0 – similar to MIT but includes patent protection.
👉 If unsure, pick MIT – it's simple and widely used.
After filling in the details, click the green "Create repository" button. Congratulations – your first GitHub repo is born! 🎉
You'll be redirected to your new repository page. If you added README, you'll see it displayed. The URL will be something like: https://github.com/your-username/repo-name
Cloning means downloading your repo from GitHub to your local machine so you can work on it. You'll need Git installed (git --version to check).
On your repo page, click the green "Code" button. Copy the HTTPS URL (e.g., https://github.com/yourname/repo.git).
Open a terminal (command prompt) and run:
git clone https://github.com/yourname/repo.git
This creates a folder named repo on your computer, with all the files (README, .gitignore, license) inside. Now you can edit, add files, commit changes, and push them back.
cd repo and git status to see that you're inside a Git repository.If you created an empty repository (without README), GitHub shows instructions. In your local folder, after adding some files, you'd run:
git init
git add .
git commit -m "first commit"
git branch -M main
git remote add origin https://github.com/yourname/repo.git
git push -u origin main
Now your local code appears on GitHub.
What we covered – quick recap
- README.md – project front page, write in Markdown.
- .gitignore – exclude unnecessary files, use templates.
- License – protect your code (MIT, GPL, etc.)
- Clone –
git clone <url>brings repo to your machine.
📘 Now you have a real GitHub repo. Time to start coding and committing!