git submodule add error: does not have a commit checked out

  1. Find leftover .git folder in some sub directories (the directory is shown in the error msg!)
find ./ -name '.git'
  1. Delete it (make sure to have the right folder!!!)
rm -r yourfolder/.git/
  1. try again

If you just created an empty Git repository on BitBucket, try and make sure to make at least one commit (or push one commit) to it.

Do that before referencing that repository as a submodule in your second local repository.


As an FYI, the same message is shown if by accident you already have a .git folder in any of the subfolder under the folder you are trying to add. If that's the case, then delete the git subfolder and if any .vs file is there, delete that too. That was my case and I had the same error message.

Tags:

Git

Bitbucket