Why is it that
git clone --mirror [repo-url]
or
git clone --mirror --recursive [repo-url]
will not work with submodules. Trying to git fetch --recurse-submodules
gives the error
fatal: Refusing to fetch into current branch refs/heads/master of non-bare repository
Excluding --mirror
however does work.
So if the repository has been cloned with --mirror
option, there is no way to bring the submodules in, unless the repository is cloned without --mirror
.
Running git submodule update --init --recursive
from the working copy gives the error message:
fatal: Not a git repository (or any of the parent directories): .git
Running git submodule init
from the mirrored repository gives this error message:
fatal: /usr/libexec/git-core/git-submodule cannot be used without a working tree.
Using GIT_WORK_TREE
and/or GIT_DIR
environment variables also does not work.
Is the only option to clone the repository from scratch again?
Edit: By the way, the reason for --mirror
in the first place was because I was following this: http://jonathannicol.com/blog/2013/11/19/automated-git-deployments-from-bitbucket/