Giter Site home page Giter Site logo

abarrows / enterprise-repo-migrater Goto Github PK

View Code? Open in Web Editor NEW

This project forked from melvinkcx/bitbucket-to-github

2.0 1.0 0.0 40 KB

Migration automation that migrates repos and all related history from Bitbucket to Github. Uses batched API requests that migrates 400 repositories within 1 - 3 hours depending on size and if LFG usage.

Home Page: https://github.com/Andrews-McMeel-Universal/

License: MIT License

JavaScript 93.68% Shell 6.32%
migrate-candidate

enterprise-repo-migrater's Introduction

Bitbucket to Github Migration - forked

This repository copies ALL of your personal/organizational Bitbucket repositories to your Github account or organization while maintaining its privacy status.

Changes made in the fork

  1. Improved logging for clearer visibility into what's happening during the process.
  • Including the start and stopping of the main functions within index.js.
  • Outputting the non-sensitive dotenv vars as they are processed to notify the engineer if variables are not instantiating. (My experience.)
  • Summary for each step in the process along with a final summary at the end. As a bonus, any failed bitbucket repositories will be listed at the end with links back to them in bitbucket.
  • Normalized all the verbiage and naming to be very consistent. IE: repos is now repository (for increased visibility)
  • Prefixed each status log with either BITBUCKET or GITHUB so the engineer knows where it is originating.
  1. Optional dotenv variables for organization (Bitbucket Organization and Github Teams) Eventually this will be created into a setting (PR's welcome!! ;-).

  2. Yarn usage instead of npm -i instruction.

  3. Testing dotenv flag to only test a subset of repos.

  4. Pragmatic improvement to the github repo creation. This script now checks first if a repo has already been created and will not try to create it again.

Requirements

  1. Node
  2. Yarn
  3. yarn install
  4. Create bitbucket app password: https://confluence.atlassian.com/bitbucket/app-passwords-828781300.html TIP: Bitbucket 2.0 api does not work well with two factor authentication so turn this off temporarily and use the app password with full rights. ('write' on all functions)
  5. Create github access token for your account: https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/
  6. Save the .env.sample as a new file named: .env ($ cp .env.sample .env) and then follow the instructions next to each variable.

General Process Explained

The steps below is how each sequential repository gets processed individually.

Duplicating a Bitbucket repository to Github a Single Time

  1. cd repositories/ && mkdir archive-client_admin && cd archive-client_admin/

  2. git clone --mirror https://bitbucket.com/amu_technology/archive-client_admin.git

  3. cd archive-client_admin.git

  4. git push --mirror https://abarrows:[email protected]/abarrows/archive-client_admin.git

  5. OPTIONAL CLEANUP:cd ../../ && rm -rf archive-client_admin

Mirroring a Bitbucket repository to Github

  1. git clone --mirror https://bitbucket.com/amu_technology/repository-to-mirror.git
  2. cd repository-to-mirror.git
  3. git remote set-url --push origin https://github.com/Andrews-McMeel-Universal/mirrored
  4. git fetch -p origin
  5. git push --mirror
Run the script
`node index.js`;

TODOS

  1. Wrap all console logs into a verbose flag.
  2. Add optional flag for "mirroring/syncing" a repo to both bitbucket and github.
  3. Improve the failsafes for operations that have already occurred.
  4. Potentially use GM's node service worker prototype to visually represent this utility.
  5. Add back in the dotenv.config() so variables are not required during the command line script.
  6. Add functionality to cleanup repos after processing.

Resources

  1. Github Instructions on this topic: https://help.github.com/en/github/importing-your-projects-to-github/importing-a-git-repository-using-the-command-line
  2. GUI Importer for failed repositories: https://help.github.com/en/github/importing-your-projects-to-github/importing-a-repository-with-github-importer

enterprise-repo-migrater's People

Contributors

pouriaa avatar abarrows avatar melvinkcx avatar

Stargazers

Olim Saidov avatar  avatar

Watchers

James Cloos avatar

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.