devroom.io/content/posts/2012-10-01-migrate-git-repositories.md

26 lines
791 B
Markdown
Raw Normal View History

2017-03-20 15:35:19 +00:00
+++
date = "2012-10-01"
title = "Migrate git repositories"
tags = ["git"]
slug = "migrate-git-repositories"
+++
2015-03-26 11:28:08 +00:00
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:
2017-03-20 15:35:19 +00:00
``` shell
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
```
2015-03-26 11:28:08 +00:00
That's it. Don't forget to update the `remote` of your working copy accordingly:
2017-03-20 15:35:19 +00:00
``` shell
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.
2015-03-26 11:28:08 +00:00