Have you ever needed to fully migrate (export and import) a git repo from one central location to another ?
Here is a step-by-step guide that works !
Before you start, make sure you know both clone URLs for the repos you are trying to export/import.
For example, to import it on GitHub, make sure that the repository you’re trying to push to already exist on GitHub and is empty.
Here are all the commands written out:
# In this example, we use an external account named extuser and
# a GitHub account named ghuser to transfer repo.git
git clone --bare https://githost.org/extuser/repo.git
# Make a bare clone of the external repository to a local directory
cd repo.git
git push --mirror https://github.com/ghuser/repo.git
# Push mirror to new GitHub repository
cd ..
rm -rf repo.git
# Remove temporary local repository
Your newly imported repository should be ready to go on GitHub!