Menu
Coddy logo textTech

Initialize A Repository

Part of the Version Control section of Coddy's Terminal journey — lesson 4 of 58.

Before Git can track a folder, you have to initialize it as a repository. The command for this is git init:

git init

Run this once inside any folder you want to track. Git creates a hidden subfolder called .git/ that holds the entire history, configuration, and internal data of the repository.

You only need to run git init once per project. After that the folder is a Git repository forever (or until you delete the .git/ folder).

Git will print a confirmation message similar to:

Initialized empty Git repository in /path/to/project/.git/
challenge icon

Challenge

Beginner

Initialize the current folder as a Git repository, then list all files (including hidden ones) so you can see the new .git folder.

Use ls -A for the listing. It shows hidden entries but skips . and ...

Cheat sheet

Initialize a folder as a Git repository with git init (run once per project):

git init

This creates a hidden .git/ subfolder that stores the entire history and configuration. Deleting .git/ removes the repository.

Try it yourself

Terminal
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Version Control