Import Contributions from Bitbucket to GitHub
Contribution history is important, if you want people to realize you put work in coding. Github has a contribution section right in your profile page, and it will display “green dots” as your contribution counts.
But what if you are not using Github? If you’re like me, you jump back and forth between projects hosted on Github and Bitbucket, your contribution history will have blank periods where it seems you have not actively been coding.
Luckily, I found a way to display on Github my contributions on Bitbucket. And I am going to show you how.
The import logic is written by miromannino, so all the credit should go to him. It is in Python, but you don’t need to know it to get it run.
Here are the steps:
Create a mock repo in your Github
This repository is actually the one that will show contributions on your Github profile. This will have fake commits, but at real time intervals. Call it anything you like, I name it mock-repo
to remind myself that it is just a placeholder to import commit history from Bitbucket.
Clone the importer program
git clone https://github.com/miromannino/Contributions-Importer-For-Github.git
It should be in the same folder as your mock repo.
At the root of the app, create a python script
# Contributions-Importer-For-Github/run_script.pyimport gitfrom git_contributions_importer import *
# Your private repo or Bitbucket reporepo = git.Repo("path/to/repo")# Your mock repomock_repo = git.Repo("path/to/your/mock-repo")importer = Importer([repo], mock_repo)# I use both my personal email and work email here,
# Since the private repo uses work email, and Github uses my personal emailimporter.set_author(['personal@email.com', 'work@company.com'])importer.import_repository()
Install gitpython
and pathlib
with pip3
pip3 install gitpython
pip3 install pathlib
You must run the script with python3
python3 run_script.py
If you see a bunch of logs running with analysing commits, you got it.
Don’t forget to push changes from your mock repo to Github.