Giter Site home page Giter Site logo

bbucket2ghub's Introduction

Bitbucket 2 GitHub Activity Sync

License: MIT

A small tool for including Bitbucket commits in the contributions graph on GitHub.

What does it do?

Say you have some repositories on Bitbucket, e.g. for work. This program allows you to shadow you coding activity on Bitbucket to the contributions chart on your Activity overview on GitHub.

Contribution graph on GitHub

You do this by querying the Bitbucket workspace for commits made by you. The program then makes a shadow repository on GitHub. Here each Bitbucket repository is represented by a file, and each Bitbucket commit is reflected by the Bitbucket commit hash.

The Bitbucket hashes are added backwards in time so the match the point in time when the original commit was made on Bitbucket.

Note: Per default the shadow repository is made private to hide sensitive information. This means that the program depends on the GitHub settings to allow to show activity from both public and private repositories (read more).

Quick start:

1) Clone the repository and install:

$ git clone https://github.com/SV3A/bBucket2gHub.git
$ cd bBucket2gHub
$ npm install

2) Create an environment file with credentials:

Rename the file .env.example to .env and fill accordingly

For now the program works with username/password for Bitbucket and Personal access tokens for GitHub. So make sure to create such a token and add it to the .env file.

3) Run the program:

$ node src/index.js

Beta support for Azure DevOps

1) Add required environment variables

AZURE_MAIL=[FILL ACCORDINGLY]
AZURE_TOKEN=[FILL ACCORDINGLY]
AZURE_PROJECT=[FILL ACCORDINGLY]
AZURE_ORG=[FILL ACCORDINGLY]

2) Run the program

$ node src/index_azure.js

bbucket2ghub's People

Contributors

cybercliff avatar dependabot[bot] avatar sv3a avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bbucket2ghub's Issues

Rate Limits

When syncing from a workspace with lots of repositories and lots of commits, there is a high possibility of being rate limited by Bitbucket and/or Github.

Github limits

Bitbucket limits

An option/flag to manually list the repos to sync would help. Alongside a timeout to prevent being rate limited.

Is it 100% safe?

I m trying to sync the bitbucket repo to github but there are lot of private repo .
Is it secure because it is asking for sensitive info on env file so that i dont loose my confidentiality

Request to https://api.github.com/user/repos failed with status 422 when running the second time

Getting repo list from Bitbucket...
Fetching commits from 1 Bitbucket repos...
Done.
Creating GitHub shadow repo...
Request to https://api.github.com/user/repos failed with status 422:
"Repository creation failed."
(node:15080) UnhandledPromiseRejectionWarning: Error: Initialization of repository failed
at GithubPusher._initShadowRepo (D:\Projects\VersionControl\bBucket2gHub\src\github\github-push.js:35:19)
at processTicksAndRejections (internal/process/task_queues.js:94:5)
at async GithubPusher.sync (D:\Projects\VersionControl\bBucket2gHub\src\github\github-push.js:156:13)
at async main (D:\Projects\VersionControl\bBucket2gHub\src\index.js:27:5)
(node:15080) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:15080) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

TypeError: Cannot read property 'forEach' of undefined

I am getting this error: failed with status 404 (node:7061) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'forEach' of undefined at BitbucketPuller.getRepoNames (.../bBucket2gHub/src/bitbucket/bitbucket-pull.js:96:29) at processTicksAndRejections (internal/process/task_queues.js:95:5) at async main (.../bBucket2gHub/src/index.js:17:19) (Use node --trace-warnings ...to show where the warning was created) (node:7061) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag--unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1) (node:7061) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. I am not good with javascript so I don't know exactly what is wrong..

How this behaves in terms of runing it the second time?

Hey Svend,
I used this a few months back and would like to sync my new commits.
Do I need to delete the previous repo so it doesn't make duplicates, or will it check the imported ones? Not sure what is the correct way to do it. Any suggestions?

Query for blob failed

Hello, I've created and added my credentials to the .env file and ran the program. I see that the program is working by reading the private repositories from my bitbucket workspace but then the program fails with this error:

            throw new Error("Query for blob failed");
                  ^

Error: Query for blob failed
    at GithubPusher._queryBlobSha (/Users/user/Desktop/bBucket2gHub/src/github/github-push.js:69:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async GithubPusher._getOrInitShadowContent (/Users/user/Desktop/bBucket2gHub/src/github/github-push.js:136:22)
    at async GithubPusher.sync (/Users/user/Desktop/bBucket2gHub/src/github/github-push.js:167:29)
    at async main (/Users/user/Desktop/bBucket2gHub/src/index.js:27:5)```
    
Is there any way to fix this issue? Any help is appreciated.

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.