GIT Repositories
GIT Repositories

Three types of GIT repositories

  1. GIT working repository
  2. GIT bare repository
  3. 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

  1. 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.
  2. 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 mirror repsitory

This repository is the exact replica of the source repository. It is created for mainly 2 purposes

  1. Autodeployment
  2. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *