How to Export GitHub Issues to GitLab and Bitbucket & keep them in sync

The recent news of Microsoft acquiring GitHub has caused a flurry of people to investigate how to export GitHub repos to other platforms. 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 in case you were one of the 100,000 repos imported to GitLab this week. 🙂 While GitLab and BitBucket both have good import tools, they don’t have a good way to import repos and issues and keep everything syncced 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, and 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:

  1. A GitLab account that has logged in using the GitHub icon – or –
  2. 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:

  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, but you can 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. 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 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 the simplest kind of sync: a mirror. 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 and ain’t nobody got time for that. The smart way is to 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! You’re good to go. Let us know if you have any questions by hitting us up @unitoio on Twitter.

 

You may also like:

Giving constructive feedback is key to building a team. Here are 5 easy steps to get it right.
New to Project Management? Here’s the Complete Manual on Running Projects of all Kinds
The Top 10 Skills For Leading Millennials
7 Ways To Remove The Project Blockers Holding Up Your Team
Get 4 months free if you sign-up for a year or if you upgrade your current plan!*
Holidays are for giving!
Get the Holiday Deal!
Holidays are for giving!
Get Deal
Get 4 months free if you sign-up for a year or if you upgrade your current plan!*
Holidays are for giving!
Get 4 months free if you sign-up for a year or if you upgrade your current plan!*
*certain conditions apply. Visit here for details
Get the Holiday Deal!
Holidays are for giving!
Get 4 months free if you sign-up for a year or if you upgrade your current plan!*
*certain conditions apply. Visit here for details
Get the Holiday Deal!