How to Export GitHub Issues to GitLab and Bitbucket & 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 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:

  1. Import your code from one tool to the other.
  2. Use Unito to sync your issues (after you export GitHub issues) to GitLab or BitBucket.
  3. 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:

  1. Go to https://github.com/settings/tokens/new
  2. Enter a token description.
  3. Select the repo scope.
  4. Click Generate token.
  5. Copy the token hash.
  6. Go back to GitLab and provide the token to the GitHub importer.
  7. 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.
  8. 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 a repo in GitLab to keep repos in sync, 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

  1. Click + in the global sidebar and select Repository under Create a new.
  2. Then click Import repository from the Create a new repository page.
  3. Select the Source of the code you want to import
  4. Enter a Name for your new repository.
  5. Uncheck This is a private repository if you want the repository to be public.
  6. Select the Repository type.
  7. 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 sync

Signing up for Unito takes just a moment and it’s free. Note that you need to sign up with either your GitHub account or a GitLab account; we don’t support signing up through your Bitbucket account (sorry!).

We’re going to build a standard sync. Basically, it’s a set up where all of the issues from each repo are copied to the other repo and then kept in sync between the two. 

Note that if you’re importing your GitHub project 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 sync.

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.

To export Github issues, start by connecting both tools you want to sync. Once you’ve done that, select your GitHub project as one end of your sync and the newly-imported repo in Gitlab or Bitbucket on the other end.

Since you want to copy every issue over, there are no filters to apply. You can just click “Create Sync”!

In a few minutes your issues will start to sync over. Once they’re done, any changes made in one tool will sync over to the other one in a few minutes. If you decide to move back to GitHub after trying out one of the other tools, all your issues will be in sync and you can pick up like you never left!

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 [email protected]:USERNAME/REPOSITORY.git

And verify your new remote. It should look something like this:

$ git remote -v

origin [email protected]:USERNAME/REPOSITORY.git (fetch)

origin [email protected]: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 [email protected]:USERNAME/REPOSITORY.git

$ git remote set-url –add –push both [email protected]:USERNAME/REPOSITORY.git

$ git remote set-url –add –push both [email protected]:USERNAME/REPOSITORY.git

And verify your new remote. It should look something like this:

$ git remote -v

both [email protected]:USERNAME/REPOSITORY.git (fetch)

both [email protected]:USERNAME/REPOSITORY.git (push)

both [email protected]:USERNAME/REPOSITORY.git (push)

origin [email protected]:USERNAME/REPOSITORY.git (fetch)

origin [email protected]: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!

Ready to get started with Unito? 

Start your free trial

It shouldn't shock you, but we use cookies on Unito.io. By using the site, you agree to let us use cookies to personalize your content on the site and all of the other cookie-type things websites do. Read about Unito & your privacy here.