Code Monkey home page Code Monkey logo

bitbucket-to-github's Introduction

Tutorial to migrate from Bitbucket to Github


Install mercurial and hg-git

sudo apt-get install mercurial 
sudo apt-get install mercurial-git

Note: The version of mercurial should be >= 2.8. If the default version of mercurial in apt-get is < 2.8. You can install using pip sudo pip install mercurial --upgrade You need to create a repo on Github.com


Clone your bitbucket repo

hg clone https://[email protected]/hbhzwj/sadit hg-repo

Convert hg repo to git repo

Hg-Git can also be used to convert a Mercurial repository to Git. You can use a local repository or a remote repository accessed via SSH, HTTP or HTTPS. Use the following commands to convert the repository

$ mkdir git-repo; cd git-repo; git init; cd ..
$ cd  hg-repo
$ hg bookmarks hg
$ hg push ../git-repo

The hg bookmark is necessary to prevent problems as otherwise hg-git pushes to the currently checked out branch confusing Git. This will create a branch named hg in the Git repository. To get the changes in master use the following command (only necessary in the first run, later just use git merge or rebase).

$ cd git-repo
$ git checkout -b master hg

Push the Git repo to Github Server

cd git-repo; 
git remote add origin <github-url>; 
git push -u origin master; 
cd ..;

Usuage of b2g.py

b2g.py is a script to ease the migration. You still need to install mercurial, hg-git and create Github repo manually.

usage: b2g.py [-h] bb_url gh_url
convert bitbucket repo to github
positional arguments:
  bb_url      bitbucket repo url
  gh_url      github repo url
optional arguments:
  -h, --help  show this help message and exit

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.