Is 'git --bare init' wrong?
Is git --bare init
wrong?
Should it 开发者_Go百科be:
git init --bare
git --bare init
is not wrong, it is just a different way to express the same (bugs notwithstanding) operation.
As a quick look at the toplevel git(1) manpage will confirm, --bare
is a global option for all Git commands which affects how the repository directory is discovered:
--bare
Treat the repository as a bare repository. If GIT_DIR environment
is not set, it is set to the current working directory.
Originally, this was the only way to have git commands operate in "bare mode", which is why you'll find git --bare init
in quite a lot of the older documents/tutorials. --bare
as separate option was added in the 1.5.6 series, to improve the CLI.
From a semantical point of view, git init --bare
is better : --bare
is related to init, not the entire git.
to initialize a d git repository the best command i am using is
git init --bare .
before execute this command make sure you are inside in your directory which one you want to create repository.
精彩评论