Skip to main content

Migrate git repositories

·95 words·1 min· ·
Git
Ariejan de Vroom
Author
Ariejan de Vroom
Jack of all Trades, Professional Software Craftsman

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:

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

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

git 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.

Related

Git: Interactive Revert
·263 words·2 mins
Git Protip
Move your latest commits to a separate branch
·153 words·1 min
Git Protip
Removing untracked files and directories with git
·346 words·2 mins
Git