How to Export GitHub Issues to GitLab and Bitbucket and Keep Them in Sync
When Microsoft acquired GitHub, it caused a flurry of people to investigate how to export GitHub repos to other platforms. In fact, some 100,000 repos were imported to GitLab in a week. While that may seem a little extreme to some, we thought we’d write a handy guide to help you test out using a platform like GitLab or Bitbucket in parallel with your GitHub repo.
Though GitLab and BitBucket both have good import tools, they don’t have a good way to import repos and issues and keep everything synced so you can try out a new platform and see if you like it enough to make the switch for good. That’s one of our most common use cases, so we thought we’d give you a quick guide on how to do it yourself.
If you’re a Unito user, you can use the following step-by-step guide to connect repositories between any of your software development tools. The walkthrough below includes instructions for syncing two GitHub repos, but the same steps and principles apply to connecting repos in Bitbucket, GitLab, Jira, and Azure DevOps. We also have a guide for exporting Github issues to Google Sheets.
If you’re not familiar with GitLab or Bitbucket, they’re all hosted version control systems. Each has its differences from GitHub: Bitbucket integrates very well with all of the other Atlassian tools; GitLab focuses on CI/CD pipelines in its free plan and also has better support for advanced features with issues.
It’s a pretty simple process, so let’s get to it. You’ll need to:
- Import your code from one tool to the other.
- Use Unito to sync your issues (after you export GitHub issues) to GitLab or BitBucket.
- Modify your git config to push code to both your original GitHub repo and your new test repo at the same time.
Import your repository
For GitLab:
Before you begin the process to export GitHub issues, ensure that any GitHub users who you want to map to GitLab users have either:
- A GitLab account that has logged in using the GitHub icon or
- Or a GitLab account with an email address that matches the public email address of the GitHub user
User-matching attempts occur in that order, and if a user is not identified either way, the activity is associated with the user account that is performing the import.
If you are not using the GitHub integration, you can still perform an authorization with GitHub to grant GitLab access your repositories. To do so:
- Go to https://github.com/settings/tokens/new
- Enter a token description.
- Select the repo scope.
- Click Generate token.
- Copy the token hash.
- Go back to GitLab and provide the token to the GitHub importer.
- Hit the List Your GitHub Repositories button and wait while GitLab reads your repositories’ information. Once done, you’ll be taken to the importer page to select the repositories to import.
- Select the repos to import and then click on the Import button.
That’s about it. Read further about how to manage the import in GitLab’s docs. Importing a GitHub repo to GitLab also imports all of the issues, PRs, wikis, and many other elements. While it is possible to mirror repos in GitLab, your issues won’t be kept in sync, and that’s where Unito comes in.
If you want to use Unito to sync your issues across both repos, you’ll need to use the bulk issue actions menu in GitLab to close or delete all of the issues that were imported. Don’t worry — we’re about to import them again!
For Bitbucket
- Click + in the global sidebar and select Repository under Create a new.
- Then click Import repository from the Create a new repository page.
- Select the Source of the code you want to import
- Enter a Name for your new repository.
- Uncheck This is a private repository if you want the repository to be public.
- Select the Repository type.
- Press Import repository
Read more about the steps to import your repo on Atlassian’s documents.
Importing a GitHub repo to Bitbucket does not import the issues.
Build your workflow
Signing up for Unito takes just a moment and it’s free. Once you’re all signed up, building out a workflow takes just a few seconds.
Start by adding a new block of work to the workflow designer. Select the GitHub repo you’d like to import. Then add another block for your GitLab or Bitbucket repo.
From there, drag a line between the two blocks to build your flow. Jump into the editor and set rules to determine exactly what information is going to be exported.
Note that if you’re importing your GitHub repo to GitLab and you imported the issues from GitHub as well, Unito won’t know that the issues are already copies and will instead create duplicates of every ticket in both platforms! Make sure you’ve used the “bulk actions” menu in GitLab to close or delete all of the existing issues before you set up your workflow.
For maximum fidelity of the two issue trackers, make sure that you’ve created all of the labels you are using in GitHub also in GitLab or Bitbucket, and that every member of your GitHub repo has an account in the new tool as well.
And that’s all there is to it. Your issues will quickly start to sync over. Once they’ve done so, any changes made in one tool will soon be reflected in the other tool. If you decide to move back to GitHub after trying out one of the other tools, you can pick back up like you never left!
With Unito, you can sync GitHub issues to GitLab, BitBucket, and any of our other 30+ integrations.
Push Git commits to two repos
Syncing issues across both repos is only useful if you’re also keeping both repos up to date together. You can always manually push to both repos every time you want to commit a change, but that’s grunt work that very few people have time for. Instead, modify your git configuration to push both at once.
The easiest way to do this is to edit the configuration in Git to add two destination URLs to your origin remote.
$ git remote set-url –add –push origin git@bitbucket.org:USERNAME/REPOSITORY.git |
And verify your new remote. It should look something like this:
$ git remote -v
origin git@github.com:USERNAME/REPOSITORY.git (fetch) origin git@bitbucket.org:USERNAME/REPOSITORY.git (push) |
Then, git push origin will push to both repositories your GitHub and Bitbucket repos.
To avoid confusion, you might want to set up a new remote called both. For example:
$ git remote add both git@github.com:USERNAME/REPOSITORY.git
$ git remote set-url –add –push both git@github.com:USERNAME/REPOSITORY.git $ git remote set-url –add –push both git@bitbucket.org:USERNAME/REPOSITORY.git |
And verify your new remote. It should look something like this:
$ git remote -v
both git@github.com:USERNAME/REPOSITORY.git (fetch) both git@github.com:USERNAME/REPOSITORY.git (push) both git@bitbucket.org:USERNAME/REPOSITORY.git (push) origin git@github.com:USERNAME/REPOSITORY.git (fetch) origin git@github.com:USERNAME/REPOSITORY.git (push) |
*Note: Be sure to replace with your own remote URL.
Then, git push both will push to both repositories.
That’s all you need to export GitHub issues!
Sync tools in seconds with Unito's simple, no-code interface.
Try Unito for 14 days, absolutely free.