Episode 4 of 12

Creating a Repository

Learn how to create a new Git repository or clone an existing one.

A repository (or "repo") is a project tracked by Git. Let's learn how to create one.

Initialise a New Repository

# Navigate to your project folder
cd my-project

# Initialise Git
git init

This creates a hidden .git folder inside your project directory.

Check Repository Status

git status

This shows which files are untracked, modified, or staged.

Clone an Existing Repository

# Clone from GitHub
git clone https://github.com/username/repo-name.git

# Clone into a specific folder
git clone https://github.com/username/repo-name.git my-folder

The .gitignore File

Create a .gitignore file to tell Git which files to ignore:

# .gitignore
node_modules/
.env
*.log
.DS_Store
dist/
.vscode/

Your First Workflow

# 1. Create a project
mkdir my-project
cd my-project

# 2. Initialise Git
git init

# 3. Create some files
echo "# My Project" > README.md

# 4. Check status
git status

# 5. Stage the file
git add README.md

# 6. Commit
git commit -m "Initial commit"

Common Status Messages

  • "Untracked files" — new files Git hasn't seen before
  • "Changes not staged" — modified files not yet added to staging
  • "Changes to be committed" — files in the staging area, ready to commit
  • "nothing to commit" — everything is saved