"git --bare init" does not create just the .git directory
This is confusing. I've read in many places that it git --bare init
sets the directory where you run the command from a yearly Git repository, the type you want to use as your central repository. In particular, I'm reading where this command creates just an empty subdirectory .git
. When I run this command from a GitGui bash window, I get multiple directories created, none of which are .git
. Conversely, if I run git init
, I get the directory .git
and all those created using the parameter --bare
. Is there something wrong with my bash tool?
source to share
The recommended use git init --bare
is to specify the name of the directory where the bare repository is stored. For example. git init --bare myproject.git
(common practice is for open vaults to end in .git
). This will create a new folder myproject.git
and put all the Git stuff in it.
If you leave the name of the repository outside the command, Git initializes the current directory as a (bare) repository. Thus, it will place all the necessary things in the current folder.
So what you see is the correct result and all of these files are necessary and required for the bare repository.
source to share