Migrating a Github repo to Bitbucket (or similar services)

Thu, Jun 6, 2013

Github is awesome. Bitbucket is awesome
too. They are both excellent services, but Bitbucket has a
plus: it's free for private repos.

That's one of the reasons on why we decided to stop paying our
$25/mo Github account for small projects and moved to Bitbucket.
Although the Bitbucket guys have now a one-click "import from
Github tool", the solution is so simple that I don't even
think it is worth using it. Because at the end of the day, even
if you uset it you'll need to change by hand where your
origin points to anyway.

The following example is a Github to Bitbucket
migration keeping the same files (no other clone
needed). You can use this code for any service though, it works
with any git repo: