debian-mirror-gitlab/doc/user/project/import/bitbucket.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

116 lines
5 KiB
Markdown
Raw Normal View History

2020-06-23 00:09:42 +05:30
---
type: reference, howto
stage: Manage
group: Import
2021-02-22 17:27:13 +05:30
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
2020-06-23 00:09:42 +05:30
---
2021-09-04 01:27:46 +05:30
# Import your project from Bitbucket Cloud to GitLab **(FREE)**
2018-03-17 18:26:18 +05:30
2021-02-22 17:27:13 +05:30
NOTE:
2022-05-07 20:08:51 +05:30
The Bitbucket Cloud importer works only with [Bitbucket.org](https://bitbucket.org/), not with Bitbucket
2018-11-18 11:00:15 +05:30
Server (aka Stash). If you are trying to import projects from Bitbucket Server, use
[the Bitbucket Server importer](bitbucket_server.md).
2018-03-17 18:26:18 +05:30
2018-11-18 11:00:15 +05:30
Import your projects from Bitbucket Cloud to GitLab with minimal effort.
2018-03-17 18:26:18 +05:30
2021-06-08 01:23:25 +05:30
The Bitbucket importer can import:
2021-11-11 11:23:49 +05:30
- Repository description
- Git repository data
- Issues
- Issue comments
- Pull requests
- Pull request comments
- Milestones
- Wiki
2021-06-08 01:23:25 +05:30
When importing:
2021-11-11 11:23:49 +05:30
- References to pull requests and issues are preserved.
2021-06-08 01:23:25 +05:30
- Repository public access is retained. If a repository is private in Bitbucket, it's created as
private in GitLab as well.
2018-03-17 18:26:18 +05:30
2022-05-07 20:08:51 +05:30
## Prerequisite for GitLab self-managed
2018-11-18 11:00:15 +05:30
2021-06-08 01:23:25 +05:30
To import your projects from Bitbucket Cloud, the [Bitbucket Cloud integration](../../../integration/bitbucket.md)
2022-05-07 20:08:51 +05:30
must be enabled. If it isn't enabled, ask your GitLab administrator to enable it. By default it's
enabled on GitLab.com.
2018-03-17 18:26:18 +05:30
## How it works
2022-05-07 20:08:51 +05:30
When issues/pull requests are being imported, the Bitbucket importer uses the Bitbucket nickname of
the author/assignee and tries to find the same Bitbucket identity in GitLab. If they don't match or
the user is not found in the GitLab database, the project creator (most of the times the current
user that started the import process) is set as the author, but a reference on the issue about the
original Bitbucket author is kept.
2018-03-17 18:26:18 +05:30
The importer will create any new namespaces (groups) if they don't exist or in
the case the namespace is taken, the repository will be imported under the user's
namespace that started the import process.
2022-06-21 17:19:12 +05:30
## Requirements for user-mapped contributions
2022-05-07 20:08:51 +05:30
For user contributions to be mapped, each user must complete the following before the project import:
1. Verify that the username in the [Bitbucket account settings](https://bitbucket.org/account/settings/)
matches the public name in the [Atlassian account settings](https://id.atlassian.com/manage-profile/profile-and-visibility).
If they don't match, modify the public name in the Atlassian account settings to match the
username in the Bitbucket account settings.
1. Connect your Bitbucket account in [GitLab profile social sign-in](https://gitlab.com/-/profile/account).
1. [Set your public email](../../profile/index.md#set-your-public-email).
2020-05-24 23:13:21 +05:30
## Import your Bitbucket repositories
2018-03-17 18:26:18 +05:30
2021-12-11 22:18:48 +05:30
1. Sign in to GitLab.
1. On the top bar, select **New** (**{plus}**).
1. Select **New project/repository**.
1. Select **Import project**.
1. Select **Bitbucket Cloud**.
1. Log in to Bitbucket and grant GitLab access to your Bitbucket account.
2018-03-17 18:26:18 +05:30
2019-10-12 21:52:04 +05:30
![Grant access](img/bitbucket_import_grant_access.png)
2018-03-17 18:26:18 +05:30
2021-12-11 22:18:48 +05:30
1. Select the projects that you'd like to import or import all projects.
You can filter projects by name and select the namespace
each project will be imported for.
2018-03-17 18:26:18 +05:30
2019-12-21 20:55:43 +05:30
![Import projects](img/bitbucket_import_select_project_v12_3.png)
2018-03-17 18:26:18 +05:30
2020-05-24 23:13:21 +05:30
## Troubleshooting
2022-05-07 20:08:51 +05:30
### If you have more than one Bitbucket account
2022-06-21 17:19:12 +05:30
Be sure to sign in to the correct account.
2022-05-07 20:08:51 +05:30
2020-05-24 23:13:21 +05:30
If you've accidentally started the import process with the wrong account, follow these steps:
1. Revoke GitLab access to your Bitbucket account, essentially reversing the process in the following procedure: [Import your Bitbucket repositories](#import-your-bitbucket-repositories).
1. Sign out of the Bitbucket account. Follow the procedure linked from the previous step.
2022-05-07 20:08:51 +05:30
### User mapping fails despite matching names
[For user mapping to work](#requirements-for-user-mapped-contributions),
the username in the Bitbucket account settings must match the public name in the Atlassian account
settings. If these names match but user mapping still fails, the user may have modified their
Bitbucket username after connecting their Bitbucket account in the
[GitLab profile social sign-in](https://gitlab.com/-/profile/account).
To fix this, the user must verify that their Bitbucket external UID in the GitLab database matches their
current Bitbucket public name, and reconnect if there's a mismatch:
1. [Use the API to get the currently authenticated user](../../../api/users.md#list-current-user-for-normal-users).
1. In the API's response, the `identities` attribute contains the Bitbucket account that exists in
the GitLab database. If the `extern_uid` doesn't match the current Bitbucket public name, the
user should reconnect their Bitbucket account in the [GitLab profile social sign-in](https://gitlab.com/-/profile/account).
1. Following reconnection, the user should use the API again to verify that their `extern_uid` in
the GitLab database now matches their current Bitbucket public name.
The importer must then [delete the imported project](../../project/working_with_projects.md#delete-a-project)
and import again.