Unable to import git repos with --mirror


We’re trying to migrate our git repositories from gitlab to phab, including all branches. However, we run into a similar problem as that mentioned here (https://secure.phabricator.com/T8936), but I have no clear guidance on how to resolve it. I’ve enabled Enormous and Dangerous changes. Pushing one branch works, but using mirror doesn’t. This is a big blocker for us. Any ideas how to fix?

$ git push phab --mirror --force                                                                                                                                           
Enumerating objects: 169, done.
Counting objects: 100% (94/94), done.
Delta compression using up to 8 threads.
Compressing objects: 100% (34/34), done.
Writing objects: 100% (64/64), 7.31 KiB | 7.31 MiB/s, done.
Total 64 (delta 42), reused 52 (delta 30)
remote: [2018-10-09 10:58:10] EXCEPTION: (Exception) Unable to identify the reftype of 'refs/remotes/origin/HEAD'. Rejecting push. at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:432]
remote: arcanist(head=master, ref.master=2650e8627a20), phabricator(head=master, ref.master=99034efa8b8d), phutil(head=master, ref.master=c6a6853ff8ae)
remote:   #0 DiffusionCommitHookEngine::findGitRefUpdates() called at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:236]
remote:   #1 DiffusionCommitHookEngine::findRefUpdates() called at [<phabricator>/src/applications/diffusion/engine/DiffusionCommitHookEngine.php:129]
remote:   #2 DiffusionCommitHookEngine::execute() called at [<phabricator>/scripts/repository/commit_hook.php:196]
To ssh://phabricator.mydomain.com/source/myproject.git
 ! [remote rejected] origin/HEAD -> origin/HEAD (pre-receive hook declined)
 ! [remote rejected] origin/develop -> origin/develop (pre-receive hook declined)
 ! [remote rejected] origin/master -> origin/master (pre-receive hook declined)
 ! [remote rejected] phab/master -> phab/master (pre-receive hook declined)
 ! [remote rejected] phase0run3 -> phase0run3 (pre-receive hook declined)
 ! [remote rejected] run2 -> run2 (pre-receive hook declined)
 ! [remote rejected] v0.3 -> v0.3 (pre-receive hook declined)
 ! [remote rejected] v1.1 -> v1.1 (pre-receive hook declined)
 ! [remote rejected] v1.1.1 -> v1.1.1 (pre-receive hook declined)
 ! [remote rejected] v1.2.pre0 -> v1.2.pre0 (pre-receive hook declined)
 ! [remote rejected] v1.2.pre1 -> v1.2.pre1 (pre-receive hook declined)
 ! [remote rejected] v1.2.pre2 -> v1.2.pre2 (pre-receive hook declined)
 ! [remote rejected] v1.2.pre3 -> v1.2.pre3 (pre-receive hook declined)
error: failed to push some refs to 'ssh://git@phabricator.mydomain.com/source/myproject.git'


Never mind…this was a mistake on our part. We had neglected to first clone with --mirror.