Reputation: 164
When running the git init
command in a completely new and empty directory, I get this error message:
Reinitialized existing Git repository in /<just path stuff>/gittests/completelyEmptyDirectory/.git/
What is going on here? The only commands being run are mkdir completelyEmptyDirectory
, going into that directory, and then running git init
.
Upvotes: 2
Views: 15907
Reputation: 164
After investigating further the reason this was happening is because in my .gitconfig
the [init]
section was pointing to my .git_templates
folder. The templates folder contains only one file called HEAD that had this:
ref: refs/heads/main
Not sure exactly why this was causing the error above.
Replacing that line with:
defaultBranch = main
resolved the issue. Still would like to figure out why the [init]
was set to point to the .git_templates
in the first place.
Upvotes: 0
Reputation: 72256
That is not an error message but the message produced by git init
when it is executed into an existing repository. You probably executed git init
twice in that directory and this is the message produced on the second run.
The documentation of git init
explains:
Running
git init
in an existing repository is safe. It will not overwrite things that are already there.
Upvotes: 2