/doc/user/project/import/bitbucket.md

https://github.com/gitlabhq/gitlabhq · Markdown · 115 lines · 80 code · 35 blank · 0 comment · 0 complexity · 47a1403e90d437ec6122ebbb2a67276d MD5 · raw file

  1. ---
  2. type: reference, howto
  3. stage: Manage
  4. group: Import
  5. info: To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
  6. ---
  7. # Import your project from Bitbucket Cloud to GitLab **(FREE)**
  8. NOTE:
  9. The Bitbucket Cloud importer works only with [Bitbucket.org](https://bitbucket.org/), not with Bitbucket
  10. Server (aka Stash). If you are trying to import projects from Bitbucket Server, use
  11. [the Bitbucket Server importer](bitbucket_server.md).
  12. Import your projects from Bitbucket Cloud to GitLab with minimal effort.
  13. The Bitbucket importer can import:
  14. - Repository description
  15. - Git repository data
  16. - Issues
  17. - Issue comments
  18. - Pull requests
  19. - Pull request comments
  20. - Milestones
  21. - Wiki
  22. When importing:
  23. - References to pull requests and issues are preserved.
  24. - Repository public access is retained. If a repository is private in Bitbucket, it's created as
  25. private in GitLab as well.
  26. ## Prerequisite for GitLab self-managed
  27. To import your projects from Bitbucket Cloud, the [Bitbucket Cloud integration](../../../integration/bitbucket.md)
  28. must be enabled. If it isn't enabled, ask your GitLab administrator to enable it. By default it's
  29. enabled on GitLab.com.
  30. ## How it works
  31. When issues/pull requests are being imported, the Bitbucket importer uses the Bitbucket nickname of
  32. the author/assignee and tries to find the same Bitbucket identity in GitLab. If they don't match or
  33. the user is not found in the GitLab database, the project creator (most of the times the current
  34. user that started the import process) is set as the author, but a reference on the issue about the
  35. original Bitbucket author is kept.
  36. The importer will create any new namespaces (groups) if they don't exist or in
  37. the case the namespace is taken, the repository will be imported under the user's
  38. namespace that started the import process.
  39. ## Requirements for user-mapped contributions
  40. For user contributions to be mapped, each user must complete the following before the project import:
  41. 1. Verify that the username in the [Bitbucket account settings](https://bitbucket.org/account/settings/)
  42. matches the public name in the [Atlassian account settings](https://id.atlassian.com/manage-profile/profile-and-visibility).
  43. If they don't match, modify the public name in the Atlassian account settings to match the
  44. username in the Bitbucket account settings.
  45. 1. Connect your Bitbucket account in [GitLab profile service sign-in](https://gitlab.com/-/profile/account).
  46. 1. [Set your public email](../../profile/index.md#set-your-public-email).
  47. ## Import your Bitbucket repositories
  48. 1. Sign in to GitLab.
  49. 1. On the top bar, select **New** (**{plus}**).
  50. 1. Select **New project/repository**.
  51. 1. Select **Import project**.
  52. 1. Select **Bitbucket Cloud**.
  53. 1. Log in to Bitbucket and grant GitLab access to your Bitbucket account.
  54. ![Grant access](img/bitbucket_import_grant_access.png)
  55. 1. Select the projects that you'd like to import or import all projects.
  56. You can filter projects by name and select the namespace
  57. each project will be imported for.
  58. ![Import projects](img/bitbucket_import_select_project_v12_3.png)
  59. ## Troubleshooting
  60. ### If you have more than one Bitbucket account
  61. Be sure to sign in to the correct account.
  62. If you've accidentally started the import process with the wrong account, follow these steps:
  63. 1. Revoke GitLab access to your Bitbucket account, essentially reversing the process in the following procedure: [Import your Bitbucket repositories](#import-your-bitbucket-repositories).
  64. 1. Sign out of the Bitbucket account. Follow the procedure linked from the previous step.
  65. ### User mapping fails despite matching names
  66. [For user mapping to work](#requirements-for-user-mapped-contributions),
  67. the username in the Bitbucket account settings must match the public name in the Atlassian account
  68. settings. If these names match but user mapping still fails, the user may have modified their
  69. Bitbucket username after connecting their Bitbucket account in the
  70. [GitLab profile service sign-in](https://gitlab.com/-/profile/account).
  71. To fix this, the user must verify that their Bitbucket external UID in the GitLab database matches their
  72. current Bitbucket public name, and reconnect if there's a mismatch:
  73. 1. [Use the API to get the currently authenticated user](../../../api/users.md#for-normal-users-1).
  74. 1. In the API's response, the `identities` attribute contains the Bitbucket account that exists in
  75. the GitLab database. If the `extern_uid` doesn't match the current Bitbucket public name, the
  76. user should reconnect their Bitbucket account in the [GitLab profile service sign-in](https://gitlab.com/-/profile/account).
  77. 1. Following reconnection, the user should use the API again to verify that their `extern_uid` in
  78. the GitLab database now matches their current Bitbucket public name.
  79. The importer must then [delete the imported project](../../project/working_with_projects.md#delete-a-project)
  80. and import again.