Recently at work I had to migrate our git repositories which we hosted our self to Github. And I wanted to share with you how I’ve done it.
First we need to do a bare clone of your old git repository. A bare clone will get all of the tags and local branches but no remote tracking branches and other refs these are completely ignored.
git clone --bare git@oldrepository:repo.git repoClone
Then push the code to your new repository
git push --mirror email@example.com:username/repo.git
Remove the repository clone
rm -Rf repoClone/
Change the remote url of your repository
git remote set-url origin firstname.lastname@example.org:username/repo.git
Note: Following guidelines should work with any repository hosting.