I recently migrated a repository from GitHub to GitLab and noticed that all pull requests and all issues are assigned to me (the user that triggered the import), instead of the actual authors in GitHub!

What happened? It seems that GitLab matches users based on their email addresses and you need to make sure users already exist in GitLab before you import a repository.

Before you begin, 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 -
- 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.
https://docs.gitlab.com/ee/user/project/import/github.html#import-your-github-repository-into-gitlab

So what are the actual steps?

  • Ask everyone to login to GitLab once, to get an account - depending on your setup this can be with GitHub OAuth or other
  • If the email address used in GitHub is different than the one in GitHub, ask people to add it to their GitLab profile: https://gitlab.com/profile/emails
  • Run the import! I suggest setting up a special "admin" or "bot" user for this, so if a match isn't found, the import will mark the bot as the owner, instead of your own personal account, which can be confusing (harder to tell if you were indeed the owner or it was a fallback from the importer)

How to check that everything worked?

  • Look at issues & pull requests reporters, assignees, commenters
  • Look at commit counts & authors
  • Check your activity in the User profile

How did importing from GitHub work for you? Do you have any tips & tricks?