One minute
How to Migrate Git Repositories
April 27, 2018
If you ever have the situation where you have a large complicated repository that you need to migrate from one host to another and you think easy, I will just check it out and push it to the new host.
Then you realise it has a heap of branches and tags that you want to keep.
WARNING: Do not do this over an existing repository as it will wipe out everything in there when it pushes.
Well its still pretty easy to do. All you have to do is the following:
git clone --bare https://urltoexistingrepo .
git remote set-url origin http://urltonewrepo
git push --mirror origin
You can now delete the local repository on your system and it should have a copy in your new repo along with all your branches and tags.