Last updated

Migrate git repositories

Sometimes you have to move your git repository to another host. In this case I want to move a privately hosted git repository to a brand spanking new github repository.

These are four easy steps to get that done:

1git clone --bare git@yourserver.com:project.git
2cd project.git
3git push --mirror git@github.com:ariejan/project.git
4cd .. && rm -rf project.git

That’s it. Don’t forget to update the remote of your working copy accordingly:

1git remote set-url origin git@github.com:ariejan/project.git

Of course, this works with any git server or service, not just Github, although Github is awesome and you should use it.

Tags: git