Are you ready to showcase your hard work and dedication on GitHub, but your contributions are scattered across Bitbucket? No worries! In this guide, we'll walk you through the process of importing your contributions from Bitbucket to GitHub effortlessly.
This process is useful for cses when your organization is working with private repositories, or bitbucket. Not everyone is using Github now, but still recruiters tend to look at the contributions made by candidates. So in order to just keep it up on visible for other to see, this is a nice tool.
Based on Daniel Mai post about importing contributions and Contributions-Importer-For-Github by miromannino
Install pipenv
Before diving into the process, make sure you have pipenv
installed on your system. If not, you can easily install it using pip.
Set Up a Mock Repository on GitHub To begin, create an empty repository on your GitHub account. This will serve as our mock repository where we'll simulate the contributions from Bitbucket.
git clone https://github.com/miromannino/Contributions-Importer-For-Github.git
#!/usr/bin/python3
import git
from src import *
repos_path = [
"/path/to/repo2/",
"/path/to/repo1/"
]
repos = []
for repo_path in repos_path:
repos.append(git.Repo(repo_path))
mock_repo_path = git.Repo("/path/to/mock/repo/")
mock_repo = git.Repo.init(mock_repo_path)
importer = Importer(repos, mock_repo)
importer.set_author(['personal@email.com', 'work@email.com'])
importer.import_repository()
This script will handle the import process from Bitbucket to GitHub. Make sure to replace the placeholders with your actual repository paths and email addresses.
import git
from src import *
This will import the libraries git and src. The src library is the one from the Contributions-Importer-For-Github.
repos_path = [
"/path/to/repo2/",
"/path/to/repo1/"
]
List of private repositories, from where we want to get the contributions (Source).
repos = []
for repo_path in repos_path:
repos.append(git.Repo(repo_path))
Iterate thru the list of repositories and add them to a list.
mock_repo_path = git.Repo("/path/to/mock/repo/")
mock_repo = git.Repo.init(mock_repo_path)
Path to the mock repo (Target). This is the empty repository we prepared before, and this repository will be fill with files to simulate the contributions made on the source repositories.
importer = Importer(repos, mock_repo)
importer.set_author(['personal@email.com', 'work@email.com'])
Initialize the importer. The set author parameter will allows us to select the author of the contributions. You need to add here the email of the author for the source repositories and also the email for the target repository.
pip3 install gitpython
pip3 install pathlib
Navigate to your mock repository directory and run the importer script.
python3 ../Contributions-Importer-For-Github/your_script_name.py
Visit your GitHub profile and behold! Your contributions from Bitbucket are now proudly displayed, matching your activity on GitHub.
With this straightforward process, you can seamlessly import your contributions from Bitbucket to GitHub, allowing you to showcase your dedication and hard work in one centralized location.
Congratulations on completing the import, and keep up the great work!
Thanks for reading, and happy coding!