The question is very simple indeed:
What is the difference between these two commands, git init
and git init --bare
?
What is this --bare
?
The question is very simple indeed:
What is the difference between these two commands, git init
and git init --bare
?
What is this --bare
?
With the command git init --bare
you are creating a repository that is pushable . Generally bare
repositories are created on the server and are considered repositories for storage, in contrast to the repositories that go on the developers' machines that would be the development repositories, created with the git init
command (without --bare
). / p>
Although the GIT is a distributed versioning control system, it is very common that there is a central repository that facilitates the exchange of information between the developers, avoiding the need for the developers' computers to communicate directly with each other. >
An illustration of the above paragraph:
Inaddition,bare
repositoriesdonothaveworkingdirectory,makingitimpossibletoeditandcommitfilesinthisrepository.
BelowisanimageofthedeveloperGITrepositoriesstream(notbare
):
Source: Atlassian - Setting up a repository
What it is:
When you start a repository such as bare , you will not be able to edit files (git add) and commit (git commit), as it does not have a working tree . You should upgrade a bare repository using git push .
When it is used:
You initialize a repository as bare when you want it to be the central repository.