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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With