Repository
In one line
A repository (repo) is a folder Git tracks — it stores your project's files and the full history of changes.
In simple words
A Git repository is a project folder that Git is watching. Inside it, Git maintains a hidden .git directory that records every change you commit, along with metadata like who made the change and when. This lets you travel back to any point in the project's history.
You create a repository with git init in an existing folder, or by cloning an existing repo with git clone. A single repository can hold anything from a tiny script to a huge application, and it tracks text files (source code) best — binary files like images are tracked but cannot be diffed line by line.
Repositories live in two places: on your local machine (where you edit and commit) and on a remote server like GitHub (where you push and pull to collaborate). The local repo is the source of truth for your working copy; the remote is the source of truth for sharing.
Example
# Create a new repository in the current folder
git init
# Check the repository status
git status
# Clone an existing repository from GitHub
git clone https://github.com/user/project.gitgit init creates a new local repo. git clone copies a remote repo to your machine, including its full history.
Related terms
Related Resources
Related Lessons
- What is a Repository?
Deep dive on repositories
- Git Init
Creating a repository
Related Projects
- Create Repository Workflow
Practice creating and configuring a repo
Learn the fundamentals
Deepen your understanding with structured lessons on this topic.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.