Git & GitHub · Lesson 5 of 144
Your First Repository
Git init.
A folder that Git is watching is called a repository, or repo for short. Any folder can become a repository, with one command. Let's make one.

- A repository is a folder Git watches
- Any folder can become one
- With one command
Make a folder, then git init
First we make a new folder called my site, with make dir, and move into it with c d. Now the magic command. Git init. Git says it initialized an empty repository. From now on, Git can track every file in this folder.
git
mkdir my-site cd my-site git init Initialized empty Git repository in /Users/sam/projects/my-site/.git/
What just happened
Git init doesn't change your files. It just adds a hidden folder called dot git. That's where Git keeps all your snapshots and history. The repository is simply your folder, plus that hidden dot git folder.
| key | value |
|---|---|
| Your files | stay exactly as they are |
| .git | a hidden folder |
| Inside .git | every snapshot |
| Repository | folder + .git |
Summary
git init turns any folder into a repository, by adding a hidden dot git folder. Next, let's peek inside it.
Key takeaways- mkdir and cd
- git init
- Adds a hidden .git folder
Next up: The Hidden .git Folder — where history lives