Three types of GIT repositories
- GIT working repository
- GIT bare repository
- GIT mirror repository
GIT working repository
This repository is the one which is on your local machine. This is the respositoy which you work on i.e. add, edit or delete your application files and commit your changes.
This repository can be created using below 2 ways
- git init: Initialises an empty working repository. Necessary files are then added or created later. This command is mostly used when you are starting with a new application in which case the repository is empty when you begin.
- git clone: This command is used if you already have a working repository on your server, GitHub, GitLab, etc. This will create a Git repository on your local maching with working/application files already inside the repository.
This repository has a .git folder with all the version related files inside this folder while your application files reside outside this folder.
GIT bare repository
This repository is generally created on your server mostly for sharing or collaboration purposes. This repository does not include your application files. It only includes the version control related files. All the commits from the local repositories are made to this repository
This repository is created using below command
git --bare init
GIT mirror repsitory
This repository is the exact replica of the source repository. It is created for mainly 2 purposes
- Back up your GIT repository to a remote server
As shown in the above diagram, a mirror repository is created on your production server to autodeploy the commits to the working directory. In the above diagram, local commits are pushed to GitHub or GitLab repository. A webhook on these servers then updates the mirror repository on your production server and updates the files in your working directory.