I am migrating repositories from gitolite to bitbucket (on-prem) using the following steps:
1) Clone existing repository from gitolite:
git clone git@gitolite.mydomain.com:/hello-world
2) Add new remote for bitbucket:
git remote add origin-bb ssh://git@bitbucket.mydomain.com:7999/test/hello-world.git
3) Push all branches to new bitbucket origin:
git push origin-bb --all
4) Push all tags to new bitbucket origin
git push origin-bb --tags
The pushes complete successfully with no errors. However, when I compare the refs between the two origins using git ls-remote -h origin
and git ls-remote -h origin-bb
the original remote has refs/heads listed for all branches, while the new remote only has refs/heads/master listed:
git ls-remote -h origin-bb
0079dbeb885c9d88ac200d533930e2e72feb3627 refs/heads/master
git ls-remote -h origin
3215eca2b034d4ee8406bca9b648808fb489c110 refs/heads/hot_fixes
5cfec9cab26d2805064b076d701e53e12ff59c51 refs/heads/develop
61e7efadb6c071f25007dda55ce8c9b73802e1c3 refs/heads/experiment
0079dbeb885c9d88ac200d533930e2e72feb3627 refs/heads/master
Is this the expected behavior or do I need an additional option when pushing to the new remote to ensure all refs are included?
Compare git ls-remote origin
not with git ls-remote origin-bb
but with git ls-remote .
i.e. with the current repo. I'm sure you'll see you only have 1 branch master
and that is what git push --all
pushed.
First you need to fetch all branches to the local repo as git clone
clones only 1 branch:
git fetch origin hot_fixes:hot_fixes
git fetch origin experiment:experiment
And now repeat git push --all origin-bb
.