Reputation: 752
This is confusing. I've read in many places that git --bare init
sets up the directory you're running the command from as a bare Git repository, the kind you want to use as a central repository. In particular, I read where this command produces simply an empty .git
subdirectory. When I run this command from the GitGui bash window, I get several directories created, none of which is .git
. Conversely, if I run git init
, I get the .git
directory and all of the ones that were created with the --bare
option. Is there something wrong with my bash tool?
Upvotes: 4
Views: 1919
Reputation: 388023
The recommended way to use git init --bare
is by specifying a directory name where the bare repository is stored. E.g. git init --bare myproject.git
(it is common practice to have bare repositories end with .git
). This will create a new folder myproject.git
and place all the things Git needs inside of them.
If you leave the name of the repository out of the command, Git will initialize the current directory as the (bare) repository. So it will put all the things it needs inside the current folder.
So what you’re seeing is the correct outcome and all those files are necessary and desired for the bare repository.
Upvotes: 6
Reputation: 209835
All those directories you see are the directories that are normally inside .git. Since there is no working copy, there's no need to separate out the regular files from the files in .git, so there is no unnecessary .git subdirectory.
Upvotes: 4