Non-bare and bare repositories
Objectives
Understanding the difference between non-bare and bare repositories.
Being able to create a common repository for a group on our local computer or server.
Instructor note
10 min teaching/demonstration
Non-bare repository
A non-bare repository contains
.git/
as well as a snapshot of your tracked files that you can directly edit called the working tree (the actual files you can edit).This is where we edit and commit changes.
When we create a repository with
git init
, it is a non-bare, “normal”, repository.
Bare repository
A bare repository contains only the
.git/
part, no files you can directly edit.By convention the names of bare repositories end with
.git
to emphasize this.We never do actual editing work inside a bare repository.
GitHub, GitLab, etc. store a bare repository.
You can also create a bare repository on your computer/server to store your private repository.
If we have enough time, the instructor demonstrates how to create a bare repository on the local computer:
Keypoints
We do programming work inside non-bare repositories.
We can create a local common bare repository where we can push to and pull from.