What is a bare repository
It can be understood as a lightweight warehouse, which only contains the .git folder.
Git is divided into three workspaces : workspace, staging area, and Git warehouse. A bare warehouse is essentially a Git warehouse without a working directory. It only contains objects in the Git repository, no other files or directories. It provides a lightweight way to share codebases as it takes up less space and transfers faster.
The difference between a bare warehouse and a normal warehouse
different content
The bare warehouse has only the .git folder and no workspace
The clone method is different
normal warehouse
git clone xxx.git
bare warehouse
git clone --bare xxx.git
file name is different
The cloned bare repository folder ends with .git.
operating restrictions
In the bare warehouse, only push and fetch operations can be performed, and direct commit or merge operations cannot be performed. This is because a bare repository has no working directory and cannot edit and merge files. Typically, a bare repository is used to implement a Git server. Developers can use it to share code bases, manage code versions, maintain team collaboration, and more.
attached
Use git init --bare <repo> to create a bare warehouse