Episode 3 of 14

Making a New Git Repository

Learn about Making a New Git Repository

A Git repository (or "repo") is simply a project folder that Git is tracking. The moment you initialize Git in a folder, it starts watching for changes. This episode covers how to create repositories and understand what Git does behind the scenes.

Creating a New Repository

# Step 1: Create a project folder
mkdir my-project
cd my-project

# Step 2: Initialize Git
git init

Output: Initialized empty Git repository in /Users/you/my-project/.git/

That's it — your folder is now a Git repository. Git created a hidden .git directory that stores all version history.

The .git Directory

Let's peek inside:

ls -la .git/

# You'll see:
# HEAD          — Points to the current branch
# config        — Repository-specific settings
# hooks/        — Scripts that run on Git events
# objects/      — All your file content and commits (the database)
# refs/         — Branch and tag pointers
# index         — The staging area

Important: Never manually edit or delete the .git folder. If you delete it, you lose the entire project history. If you want to "un-Git" a folder, deleting .git is the way — but only do it intentionally.

Cloning an Existing Repository

# Clone from GitHub (or any remote)
git clone https://github.com/user/project.git

# Clone into a specific folder name
git clone https://github.com/user/project.git my-custom-name

# Clone with SSH (if you have SSH keys set up)
git clone git@github.com:user/project.git

Cloning downloads the entire repository — all files, all branches, and the complete commit history.

Checking Repository Status

# The most-used Git command
git status

When you run git status in a fresh repo, you'll see:

On branch main

No commits yet

nothing to commit (create/copy files and use "git add" to track)

This tells you: you're on the main branch, there are no commits yet, and there are no files to track.

Your First File

# Create a file
echo "# My Project" > README.md

# Check status again
git status

Now you'll see:

On branch main

No commits yet

Untracked files:
  (use "git add ..." to include in what will be committed)
        README.md

nothing added to commit but untracked files present (use "git add" to track)

Git sees the file but isn't tracking it yet. The file is "untracked" — it exists in your working directory but Git doesn't know about it. In the next episode, we'll learn how to "stage" files to prepare them for a commit.

Init vs Clone

  • git init — Creates a brand new repository from scratch. Use when starting a new project.
  • git clone — Copies an existing repository (from GitHub, GitLab, etc.). Use when joining an existing project.

What's Next

You've created your first repository. In the next episode, we'll learn about staging — the process of selecting which changes to include in your next commit.