Step 4: Your First Repository
A repository (or "repo") is simply a folder that Git is watching. Let's create your very first one!
Create a Repo Step by Step
1. Create a new folder
Open your terminal and create a project folder:
mkdir my-first-repo
cd my-first-repo2. Initialize Git
Turn this folder into a Git repository:
git initYou should see: Initialized empty Git repository
3. Check the status
See what Git knows about your folder:
git statusThis shows you're on the main branch with no commits yet. That's expected — we haven't saved anything yet!
What Just Happened?
When you ran git init, Git created a hidden .git folder inside your project. This folder stores all the history and tracking information. You never need to touch this folder directly — Git manages it for you.
Try It Yourself
Create a file in your new repo and check the status again:
echo "Hello, Git!" > hello.txt
git statusYou should see hello.txt listed as an "untracked file". Git sees the file but isn't tracking it yet — we'll fix that in the next lesson!
Common Mistakes
- Running git init in the wrong folder — Always make sure you're inside the project folder before running
git init. - Initializing in your home directory — Don't run
git initin your Desktop or home folder. Always create a dedicated project folder first.
Quick Summary
- A repository is a folder tracked by Git
- Use
git initto create a new repo - Use
git statusto see what's happening