One complete answer of cloning from one (bare) repository to another (bare) repository taking ALL branches, not just the checked out ones, is to clone a local bare repository as an intermediary. Then all branches are pulled as part of the clone and a git push --all will push them all. Example performed on Windows from github to gitlab:
- git clone --bare git@github.com:robe070/cookbooks.git
- cd cookbooks.git
- git remote add gitlab git@gitlab.com:robe071/cookbookstest2.git
- git push --force --all gitlab
- git push --force --tags gitlab
Result: 25 branches pushed to gitlab
Note, git checkout is not required for all the branches and meaningless to a bare repo anyway.